From 1fc960cfd7a3a6ae6cb089d3fe2936fe8fe1197a Mon Sep 17 00:00:00 2001 From: George Raduta Date: Fri, 27 Oct 2023 17:15:51 +0200 Subject: [PATCH] [OGUI-1410] Add first calibration page with components for displaying latest info (#2181) * builds the initial version of the calibration page which displays the latest calibrationRuns for each detector and runType as per the configuration stored in the KV runtime store. * unifies the usage of `bookkeeping` from configuration file and removes duplicated one * bumps `web-ui` to make use of the `formatTimeDuration` --- Control/config-default.js | 8 +- Control/lib/config/publicConfigProvider.js | 8 +- Control/lib/services/Run.service.js | 5 + Control/package-lock.json | 219 ++++++++++-------- Control/package.json | 2 +- Control/public/Model.js | 9 + Control/public/common/card/miniCard.js | 6 +- Control/public/common/coloredBadge.js | 28 +++ .../common/enums/runCalibrationStatus.enum.js | 24 ++ Control/public/common/sidebar.js | 3 +- .../CalibrationRuns/CalibrationRuns.model.js | 71 ++++++ .../CalibrationRuns/CalibrationRuns.page.js | 34 +++ .../components/calibrationRunCard.js | 30 +++ .../components/calibrationRunCardTitle.js | 39 ++++ .../components/calibrationRunGroups.js | 53 +++++ .../components/calibrationRunsContent.js | 37 +++ Control/public/view.js | 6 + .../test/lib/config/mocha-public-config.js | 10 +- Control/test/mocha-index.js | 2 +- Control/test/test-config.js | 3 - 20 files changed, 474 insertions(+), 123 deletions(-) create mode 100644 Control/public/common/coloredBadge.js create mode 100644 Control/public/common/enums/runCalibrationStatus.enum.js create mode 100644 Control/public/pages/CalibrationRuns/CalibrationRuns.model.js create mode 100644 Control/public/pages/CalibrationRuns/CalibrationRuns.page.js create mode 100644 Control/public/pages/CalibrationRuns/components/calibrationRunCard.js create mode 100644 Control/public/pages/CalibrationRuns/components/calibrationRunCardTitle.js create mode 100644 Control/public/pages/CalibrationRuns/components/calibrationRunGroups.js create mode 100644 Control/public/pages/CalibrationRuns/components/calibrationRunsContent.js diff --git a/Control/config-default.js b/Control/config-default.js index 9d12693f5..a17a36097 100644 --- a/Control/config-default.js +++ b/Control/config-default.js @@ -29,7 +29,8 @@ module.exports = { }, bookkeeping: { url: 'http://localhost:4000', - token: 'some-token' + token: 'some-token', + refreshRate: 10000, }, consul: { ui: 'localhost:8500', @@ -52,11 +53,6 @@ module.exports = { qcGui: { url: 'qcg.cern.ch' }, - bookkeepingGui: { - url: 'ali-bookkeeping.cern.ch', - token: 'token', - refreshRate: 10000, - }, utils: { refreshTask: 10000, // how often should task list page should refresh its content }, diff --git a/Control/lib/config/publicConfigProvider.js b/Control/lib/config/publicConfigProvider.js index 3c8a6f3c4..e85edafa9 100644 --- a/Control/lib/config/publicConfigProvider.js +++ b/Control/lib/config/publicConfigProvider.js @@ -50,7 +50,7 @@ function getConsulConfig(config) { const conf = config.consul; conf.protocol = conf?.protocol || 'http'; conf.flpHardwarePath = conf?.flpHardwarePath || 'o2/hardware/flps'; - conf.detHardwarePath = conf?.detHardwarePath ||'o2/hardware/detectors', + conf.detHardwarePath = conf?.detHardwarePath || 'o2/hardware/detectors', conf.readoutCardPath = conf?.readoutCardPath || 'o2/components/readoutcard'; conf.qcPath = conf?.qcPath || 'o2/components/qc'; conf.readoutPath = conf?.readoutPath || 'o2/components/readout'; @@ -126,9 +126,9 @@ function _getQcgURL(config) { * @param {JSON} config - server configuration * @returns {string} */ -function _getBookkeepingURL(config) { - const bkp = config?.bookkeepingGui; - return (bkp?.url) ? `${bkp.url}` : ''; +function _getBookkeepingURL(config = {}) { + const {bookkeeping = {}} = config; + return bookkeeping.url ? new URL(bookkeeping.url) : null } module.exports = { diff --git a/Control/lib/services/Run.service.js b/Control/lib/services/Run.service.js index 6eb3dc0f9..6a1bf5f7a 100644 --- a/Control/lib/services/Run.service.js +++ b/Control/lib/services/Run.service.js @@ -60,6 +60,11 @@ class RunService { */ this._calibrationRunsPerDetector = {}; + /** + * @type {Object>} + */ + this._calibrationRunsPerDetector = {}; + this._logger = new Log(`${process.env.npm_config_log_label ?? 'cog'}/run-service`); } diff --git a/Control/package-lock.json b/Control/package-lock.json index 99702b64b..498dc01f9 100644 --- a/Control/package-lock.json +++ b/Control/package-lock.json @@ -14,7 +14,7 @@ ], "license": "GPL-3.0", "dependencies": { - "@aliceo2/web-ui": "2.3.0", + "@aliceo2/web-ui": "2.5.0", "@grpc/grpc-js": "1.9.0", "@grpc/proto-loader": "0.7.0", "google-protobuf": "3.21.0" @@ -41,23 +41,23 @@ } }, "node_modules/@aliceo2/web-ui": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@aliceo2/web-ui/-/web-ui-2.3.0.tgz", - "integrity": "sha512-L3137N0vgxZNiQtde6R1Av4k2W13jQQTCtvxk2lPTkjB0FQfQk/rYdrJVKIzTcBeczjsFoQ/TXKxDTUOqV6fzQ==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@aliceo2/web-ui/-/web-ui-2.5.0.tgz", + "integrity": "sha512-b24kqXKZt8pc/8XOJFy4VMe9gLlgeeu4Wip01Y6ndiulQoXjvphA/bVN/w7F8G+VtsoV49N057c6CmzJeBh7kg==", "inBundle": true, "dependencies": { "express": "^4.18.0", - "helmet": "^6.0.0", + "helmet": "^7.0.0", "jsonwebtoken": "^9.0.0", "kafkajs": "^2.2.0", "mithril": "1.1.7", "mysql": "^2.18.1", - "openid-client": "^5.4.0", - "winston": "3.8.1", - "ws": "^8.13.0" + "openid-client": "^5.6.0", + "winston": "3.11.0", + "ws": "^8.14.2" }, "engines": { - "node": ">= 16.x" + "node": ">= 18.x" } }, "node_modules/@babel/code-frame": { @@ -381,9 +381,9 @@ } }, "node_modules/@colors/colors": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", - "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz", + "integrity": "sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==", "inBundle": true, "engines": { "node": ">=0.1.90" @@ -1001,6 +1001,12 @@ "integrity": "sha512-EdxgKRXgYsNITy5mjjXjVE/CS8YENSdhiagGrLqjG0pvA2owgJ6i4l7wy/PFZGC0B1/H20lWKN7ONVDNYDZm7A==", "inBundle": true }, + "node_modules/@types/triple-beam": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.4.tgz", + "integrity": "sha512-HlJjF3wxV4R2VQkFpKe0YqJLilYNgtRtsqqZtby7RkVsSs+i+vbyzjtUwpFEdUCKcrGzCiEJE7F/0mKjh0sunA==", + "inBundle": true + }, "node_modules/@types/yauzl": { "version": "2.10.2", "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.2.tgz", @@ -2802,12 +2808,12 @@ } }, "node_modules/helmet": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/helmet/-/helmet-6.0.0.tgz", - "integrity": "sha512-FO9RpR1wNJepH/GbLPQVtkE2eESglXL641p7SdyoT4LngHFJcZheHMoyUcjCZF4qpuMMO1u5q6RK0l9Ux8JBcg==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/helmet/-/helmet-7.0.0.tgz", + "integrity": "sha512-MsIgYmdBh460ZZ8cJC81q4XJknjG567wzEmv46WOBblDb6TUd3z8/GhgmsM9pn8g2B80tAJ4m5/d3Bi1KrSUBQ==", "inBundle": true, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/html-escaper": { @@ -3303,9 +3309,9 @@ } }, "node_modules/jose": { - "version": "4.13.1", - "resolved": "https://registry.npmjs.org/jose/-/jose-4.13.1.tgz", - "integrity": "sha512-MSJQC5vXco5Br38mzaQKiq9mwt7lwj2eXpgpRyQYNHYt2lq1PjkWa7DLXX0WVcQLE9HhMh3jPiufS7fhJf+CLQ==", + "version": "4.15.4", + "resolved": "https://registry.npmjs.org/jose/-/jose-4.15.4.tgz", + "integrity": "sha512-W+oqK4H+r5sITxfxpSU+MMdr/YSWGvgZMQDIsNoBDGGy4i7GBPTtvFKibQzW06n3U3TqHjhvBJsirShsEJ6eeQ==", "inBundle": true, "funding": { "url": "https://github.com/sponsors/panva" @@ -3617,16 +3623,20 @@ } }, "node_modules/logform": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/logform/-/logform-2.4.2.tgz", - "integrity": "sha512-W4c9himeAwXEdZ05dQNerhFz2XG80P9Oj0loPUMV23VC2it0orMHQhJm4hdnnor3rd1HsGf6a2lPwBM1zeXHGw==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/logform/-/logform-2.6.0.tgz", + "integrity": "sha512-1ulHeNPp6k/LD8H91o7VYFBng5i1BDE7HoKxVbZiGFidS1Rj65qcywLxX+pVfAPoQJEjRdvKcusKwOupHCVOVQ==", "inBundle": true, "dependencies": { - "@colors/colors": "1.5.0", + "@colors/colors": "1.6.0", + "@types/triple-beam": "^1.3.2", "fecha": "^4.2.0", "ms": "^2.1.1", "safe-stable-stringify": "^2.3.1", "triple-beam": "^1.3.0" + }, + "engines": { + "node": ">= 12.0.0" } }, "node_modules/logform/node_modules/ms": { @@ -4332,9 +4342,9 @@ } }, "node_modules/oidc-token-hash": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/oidc-token-hash/-/oidc-token-hash-5.0.1.tgz", - "integrity": "sha512-EvoOtz6FIEBzE+9q253HsLCVRiK/0doEJ2HCvvqMQb3dHZrP3WlJKYtJ55CRTw4jmYomzH4wkPuCj/I3ZvpKxQ==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/oidc-token-hash/-/oidc-token-hash-5.0.3.tgz", + "integrity": "sha512-IF4PcGgzAr6XXSff26Sk/+P4KZFJVuHAJZj3wgO3vX2bMdNVp/QXTP3P7CEm9V1IdG8lDLY3HhiqpsE/nOwpPw==", "inBundle": true, "engines": { "node": "^10.13.0 || >=12.0.0" @@ -4371,15 +4381,15 @@ } }, "node_modules/openid-client": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.4.0.tgz", - "integrity": "sha512-hgJa2aQKcM2hn3eyVtN12tEA45ECjTJPXCgUh5YzTzy9qwapCvmDTVPWOcWVL0d34zeQoQ/hbG9lJhl3AYxJlQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.6.1.tgz", + "integrity": "sha512-PtrWsY+dXg6y8mtMPyL/namZSYVz8pjXz3yJiBNZsEdCnu9miHLB4ELVC85WvneMKo2Rg62Ay7NkuCpM0bgiLQ==", "inBundle": true, "dependencies": { - "jose": "^4.10.0", + "jose": "^4.15.1", "lru-cache": "^6.0.0", - "object-hash": "^2.0.1", - "oidc-token-hash": "^5.0.1" + "object-hash": "^2.2.0", + "oidc-token-hash": "^5.0.3" }, "funding": { "url": "https://github.com/sponsors/panva" @@ -5117,9 +5127,9 @@ "inBundle": true }, "node_modules/safe-stable-stringify": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.1.tgz", - "integrity": "sha512-dVHE6bMtS/bnL2mwualjc6IxEv1F+OCUpA46pKUj6F8uDbUM0jCCulPqRNPSnWwGNKx5etqMjZYdXtrm5KJZGA==", + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", + "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", "inBundle": true, "engines": { "node": ">=10" @@ -5599,10 +5609,13 @@ "dev": true }, "node_modules/triple-beam": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", - "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==", - "inBundle": true + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.4.1.tgz", + "integrity": "sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==", + "inBundle": true, + "engines": { + "node": ">= 14.0.0" + } }, "node_modules/tslib": { "version": "2.6.2", @@ -5777,11 +5790,12 @@ "dev": true }, "node_modules/winston": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.8.1.tgz", - "integrity": "sha512-r+6YAiCR4uI3N8eQNOg8k3P3PqwAm20cLKlzVD9E66Ch39+LZC+VH1UKf9JemQj2B3QoUHfKD7Poewn0Pr3Y1w==", + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.11.0.tgz", + "integrity": "sha512-L3yR6/MzZAOl0DsysUXHVjOwv8mKZ71TrA/41EIduGpOOV5LQVodqN+QdQ6BS6PJ/RdIshZhq84P/fStEZkk7g==", "inBundle": true, "dependencies": { + "@colors/colors": "^1.6.0", "@dabh/diagnostics": "^2.0.2", "async": "^3.2.3", "is-stream": "^2.0.0", @@ -5798,9 +5812,9 @@ } }, "node_modules/winston-transport": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.5.0.tgz", - "integrity": "sha512-YpZzcUzBedhlTAfJg6vJDlyEai/IFMIVcaEZZyl3UXIl4gmqRpU7AE89AHLkbzLUsv0NVmw7ts+iztqKxxPW1Q==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.6.0.tgz", + "integrity": "sha512-wbBA9PbPAHxKiygo7ub7BYRiKxms0tpfU2ljtWzb3SjRjv5yl6Ozuy/TkXf00HTAt+Uylo3gSkNwzc4ME0wiIg==", "inBundle": true, "dependencies": { "logform": "^2.3.2", @@ -5808,13 +5822,13 @@ "triple-beam": "^1.3.0" }, "engines": { - "node": ">= 6.4.0" + "node": ">= 12.0.0" } }, "node_modules/winston-transport/node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "inBundle": true, "dependencies": { "inherits": "^2.0.3", @@ -5826,9 +5840,9 @@ } }, "node_modules/winston/node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "inBundle": true, "dependencies": { "inherits": "^2.0.3", @@ -6043,19 +6057,19 @@ "dev": true }, "@aliceo2/web-ui": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@aliceo2/web-ui/-/web-ui-2.3.0.tgz", - "integrity": "sha512-L3137N0vgxZNiQtde6R1Av4k2W13jQQTCtvxk2lPTkjB0FQfQk/rYdrJVKIzTcBeczjsFoQ/TXKxDTUOqV6fzQ==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@aliceo2/web-ui/-/web-ui-2.5.0.tgz", + "integrity": "sha512-b24kqXKZt8pc/8XOJFy4VMe9gLlgeeu4Wip01Y6ndiulQoXjvphA/bVN/w7F8G+VtsoV49N057c6CmzJeBh7kg==", "requires": { "express": "^4.18.0", - "helmet": "^6.0.0", + "helmet": "^7.0.0", "jsonwebtoken": "^9.0.0", "kafkajs": "^2.2.0", "mithril": "1.1.7", "mysql": "^2.18.1", - "openid-client": "^5.4.0", - "winston": "3.8.1", - "ws": "^8.13.0" + "openid-client": "^5.6.0", + "winston": "3.11.0", + "ws": "^8.14.2" } }, "@babel/code-frame": { @@ -6318,9 +6332,9 @@ } }, "@colors/colors": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", - "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==" + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz", + "integrity": "sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==" }, "@dabh/diagnostics": { "version": "2.0.3", @@ -6793,6 +6807,11 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.6.tgz", "integrity": "sha512-EdxgKRXgYsNITy5mjjXjVE/CS8YENSdhiagGrLqjG0pvA2owgJ6i4l7wy/PFZGC0B1/H20lWKN7ONVDNYDZm7A==" }, + "@types/triple-beam": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.4.tgz", + "integrity": "sha512-HlJjF3wxV4R2VQkFpKe0YqJLilYNgtRtsqqZtby7RkVsSs+i+vbyzjtUwpFEdUCKcrGzCiEJE7F/0mKjh0sunA==" + }, "@types/yauzl": { "version": "2.10.2", "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.2.tgz", @@ -8090,9 +8109,9 @@ "dev": true }, "helmet": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/helmet/-/helmet-6.0.0.tgz", - "integrity": "sha512-FO9RpR1wNJepH/GbLPQVtkE2eESglXL641p7SdyoT4LngHFJcZheHMoyUcjCZF4qpuMMO1u5q6RK0l9Ux8JBcg==" + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/helmet/-/helmet-7.0.0.tgz", + "integrity": "sha512-MsIgYmdBh460ZZ8cJC81q4XJknjG567wzEmv46WOBblDb6TUd3z8/GhgmsM9pn8g2B80tAJ4m5/d3Bi1KrSUBQ==" }, "html-escaper": { "version": "2.0.2", @@ -8452,9 +8471,9 @@ } }, "jose": { - "version": "4.13.1", - "resolved": "https://registry.npmjs.org/jose/-/jose-4.13.1.tgz", - "integrity": "sha512-MSJQC5vXco5Br38mzaQKiq9mwt7lwj2eXpgpRyQYNHYt2lq1PjkWa7DLXX0WVcQLE9HhMh3jPiufS7fhJf+CLQ==" + "version": "4.15.4", + "resolved": "https://registry.npmjs.org/jose/-/jose-4.15.4.tgz", + "integrity": "sha512-W+oqK4H+r5sITxfxpSU+MMdr/YSWGvgZMQDIsNoBDGGy4i7GBPTtvFKibQzW06n3U3TqHjhvBJsirShsEJ6eeQ==" }, "js-tokens": { "version": "4.0.0", @@ -8693,11 +8712,12 @@ } }, "logform": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/logform/-/logform-2.4.2.tgz", - "integrity": "sha512-W4c9himeAwXEdZ05dQNerhFz2XG80P9Oj0loPUMV23VC2it0orMHQhJm4hdnnor3rd1HsGf6a2lPwBM1zeXHGw==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/logform/-/logform-2.6.0.tgz", + "integrity": "sha512-1ulHeNPp6k/LD8H91o7VYFBng5i1BDE7HoKxVbZiGFidS1Rj65qcywLxX+pVfAPoQJEjRdvKcusKwOupHCVOVQ==", "requires": { - "@colors/colors": "1.5.0", + "@colors/colors": "1.6.0", + "@types/triple-beam": "^1.3.2", "fecha": "^4.2.0", "ms": "^2.1.1", "safe-stable-stringify": "^2.3.1", @@ -9237,9 +9257,9 @@ "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==" }, "oidc-token-hash": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/oidc-token-hash/-/oidc-token-hash-5.0.1.tgz", - "integrity": "sha512-EvoOtz6FIEBzE+9q253HsLCVRiK/0doEJ2HCvvqMQb3dHZrP3WlJKYtJ55CRTw4jmYomzH4wkPuCj/I3ZvpKxQ==" + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/oidc-token-hash/-/oidc-token-hash-5.0.3.tgz", + "integrity": "sha512-IF4PcGgzAr6XXSff26Sk/+P4KZFJVuHAJZj3wgO3vX2bMdNVp/QXTP3P7CEm9V1IdG8lDLY3HhiqpsE/nOwpPw==" }, "on-finished": { "version": "2.4.1", @@ -9267,14 +9287,14 @@ } }, "openid-client": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.4.0.tgz", - "integrity": "sha512-hgJa2aQKcM2hn3eyVtN12tEA45ECjTJPXCgUh5YzTzy9qwapCvmDTVPWOcWVL0d34zeQoQ/hbG9lJhl3AYxJlQ==", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.6.1.tgz", + "integrity": "sha512-PtrWsY+dXg6y8mtMPyL/namZSYVz8pjXz3yJiBNZsEdCnu9miHLB4ELVC85WvneMKo2Rg62Ay7NkuCpM0bgiLQ==", "requires": { - "jose": "^4.10.0", + "jose": "^4.15.1", "lru-cache": "^6.0.0", - "object-hash": "^2.0.1", - "oidc-token-hash": "^5.0.1" + "object-hash": "^2.2.0", + "oidc-token-hash": "^5.0.3" } }, "optionator": { @@ -9805,9 +9825,9 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "safe-stable-stringify": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.1.tgz", - "integrity": "sha512-dVHE6bMtS/bnL2mwualjc6IxEv1F+OCUpA46pKUj6F8uDbUM0jCCulPqRNPSnWwGNKx5etqMjZYdXtrm5KJZGA==" + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", + "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==" }, "safer-buffer": { "version": "2.1.2", @@ -10181,9 +10201,9 @@ "dev": true }, "triple-beam": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", - "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==" + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.4.1.tgz", + "integrity": "sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==" }, "tslib": { "version": "2.6.2", @@ -10319,10 +10339,11 @@ "dev": true }, "winston": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.8.1.tgz", - "integrity": "sha512-r+6YAiCR4uI3N8eQNOg8k3P3PqwAm20cLKlzVD9E66Ch39+LZC+VH1UKf9JemQj2B3QoUHfKD7Poewn0Pr3Y1w==", + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.11.0.tgz", + "integrity": "sha512-L3yR6/MzZAOl0DsysUXHVjOwv8mKZ71TrA/41EIduGpOOV5LQVodqN+QdQ6BS6PJ/RdIshZhq84P/fStEZkk7g==", "requires": { + "@colors/colors": "^1.6.0", "@dabh/diagnostics": "^2.0.2", "async": "^3.2.3", "is-stream": "^2.0.0", @@ -10336,9 +10357,9 @@ }, "dependencies": { "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -10348,9 +10369,9 @@ } }, "winston-transport": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.5.0.tgz", - "integrity": "sha512-YpZzcUzBedhlTAfJg6vJDlyEai/IFMIVcaEZZyl3UXIl4gmqRpU7AE89AHLkbzLUsv0NVmw7ts+iztqKxxPW1Q==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.6.0.tgz", + "integrity": "sha512-wbBA9PbPAHxKiygo7ub7BYRiKxms0tpfU2ljtWzb3SjRjv5yl6Ozuy/TkXf00HTAt+Uylo3gSkNwzc4ME0wiIg==", "requires": { "logform": "^2.3.2", "readable-stream": "^3.6.0", @@ -10358,9 +10379,9 @@ }, "dependencies": { "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", diff --git a/Control/package.json b/Control/package.json index f8be6e521..78496e70a 100644 --- a/Control/package.json +++ b/Control/package.json @@ -27,7 +27,7 @@ "coverage-local": "nyc --reporter=lcov npm run mocha" }, "dependencies": { - "@aliceo2/web-ui": "2.3.0", + "@aliceo2/web-ui": "2.5.0", "@grpc/grpc-js": "1.9.0", "@grpc/proto-loader": "0.7.0", "google-protobuf": "3.21.0" diff --git a/Control/public/Model.js b/Control/public/Model.js index fabd79979..b5b03dbba 100644 --- a/Control/public/Model.js +++ b/Control/public/Model.js @@ -25,7 +25,10 @@ import DetectorService from './services/DetectorService.js'; import {PREFIX, ROLES} from './../workflow/constants.js'; import {SERVICE_STATES} from './common/constants/serviceStates.js'; import {di} from './utilities/di.js'; + import {EnvironmentCreationModel} from './pages/EnvironmentCreation/EnvironmentCreation.model.js'; +import {CalibrationRunsModel} from './pages/CalibrationRuns/CalibrationRuns.model.js'; + import {STATUS_COMPONENTS_KEYS} from './common/constants/statusComponents.enum.js'; /** @@ -74,6 +77,9 @@ export default class Model extends Observable { this.envCreationModel = new EnvironmentCreationModel(this); this.envCreationModel.bubbleTo(this); + this.calibrationRunsModel = new CalibrationRunsModel(this); + this.calibrationRunsModel.bubbleTo(this); + this.task = new Task(this); this.task.bubbleTo(this); @@ -240,6 +246,9 @@ export default class Model extends Observable { case 'newEnvironment': this.envCreationModel.initPage(); break; + case 'calibrationRuns': + this.calibrationRunsModel.initPage(); + break; case 'taskList': this.task.getTasks(); break; diff --git a/Control/public/common/card/miniCard.js b/Control/public/common/card/miniCard.js index bafaea055..ecd5eb6d9 100644 --- a/Control/public/common/card/miniCard.js +++ b/Control/public/common/card/miniCard.js @@ -21,9 +21,9 @@ import {h} from '/js/src/index.js'; * @param {Array} [classes] - object containing style parameters * @returns {vnode} */ -export const miniCard = (title, children = [], classes = []) => { - return h(`.miniCard.flex-column.shadow-level1.br2.p2.g2`, { - class: classes +export const miniCard = (title, children = [], classes = ['p2', 'g2']) => { + return h(`.miniCard.flex-column.shadow-level1.br2`, { + class: classes.join(' ') }, [ typeof title === 'string' ? miniCardTitle(title) diff --git a/Control/public/common/coloredBadge.js b/Control/public/common/coloredBadge.js new file mode 100644 index 000000000..18c3e1d1e --- /dev/null +++ b/Control/public/common/coloredBadge.js @@ -0,0 +1,28 @@ +/** + * @license + * Copyright CERN and copyright holders of ALICE O2. This software is + * distributed under the terms of the GNU General Public License v3 (GPL + * Version 3), copied verbatim in the file "COPYING". + * + * See http://alice-o2.web.cern.ch/license for full licensing information. + * + * In applying this license CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization + * or submit itself to any jurisdiction. + */ + +import {h} from '/js/src/index.js'; + +/** + * Return a colored cell based on a given value and mapping associated + * + * @param {String} value - the value to be displayed in the cell + * @param {Object} colorMap - map storing color based on value + * @return {vnode} - the colored cell + */ +export const coloredBadge = (value = '', colorMap = {}) => { + const valueAsKey = value.split(' ').join('_'); + return h('.badge.white', { + class: `bg-${colorMap[valueAsKey] ?? 'gray'}`, + }, value); +}; diff --git a/Control/public/common/enums/runCalibrationStatus.enum.js b/Control/public/common/enums/runCalibrationStatus.enum.js new file mode 100644 index 000000000..2748fff5d --- /dev/null +++ b/Control/public/common/enums/runCalibrationStatus.enum.js @@ -0,0 +1,24 @@ +/** + * @license + * Copyright CERN and copyright holders of ALICE O2. This software is + * distributed under the terms of the GNU General Public License v3 (GPL + * Version 3), copied verbatim in the file "COPYING". + * + * See http://alice-o2.web.cern.ch/license for full licensing information. + * + * In applying this license CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization + * or submit itself to any jurisdiction. + */ + +export const RUN_CALIBRATION_STATUS = Object.freeze({ + SUCCESS: 'SUCCESS', + FAILED: 'FAILED', + NO_STATUS: 'NO STATUS', +}); + +export const RUN_CALIBRATION_STATUS_COLOR_MAP = Object.freeze({ + SUCCESS: 'success', + FAILED: 'danger', + NO_STATUS: 'gray-darker', +}); diff --git a/Control/public/common/sidebar.js b/Control/public/common/sidebar.js index dde20467a..e1b2d2c53 100644 --- a/Control/public/common/sidebar.js +++ b/Control/public/common/sidebar.js @@ -15,7 +15,7 @@ import {h} from '/js/src/index.js'; import { iconGridTwoUp, iconGridThreeUp, iconExcerpt, iconPlus, iconMediaSkipBackward, iconMediaSkipForward, iconCog, - iconCalculator, iconLockLocked + iconCalculator, iconLockLocked, iconWrench } from '/js/src/icons.js'; /** @@ -27,6 +27,7 @@ export default (model) => h('.absolute-fill scroll-y.flex-column', [ h('h5.menu-title-large.mh1', model.sideBarMenu ? 'Environments' : 'ENVS'), menuItem(model, 'Global Runs', 'newEnvironment', iconPlus()), + menuItem(model, 'Calibration Runs', 'calibrationRuns', iconWrench()), menuItem(model, 'Active Runs', 'environments', iconGridTwoUp()), menuItem(model, 'Create', 'newEnvironmentAdvanced', iconPlus()), menuItem(model, 'Task list', 'taskList', iconGridThreeUp()), diff --git a/Control/public/pages/CalibrationRuns/CalibrationRuns.model.js b/Control/public/pages/CalibrationRuns/CalibrationRuns.model.js new file mode 100644 index 000000000..ab9bb9296 --- /dev/null +++ b/Control/public/pages/CalibrationRuns/CalibrationRuns.model.js @@ -0,0 +1,71 @@ +/** + * @license + * Copyright CERN and copyright holders of ALICE O2. This software is + * distributed under the terms of the GNU General Public License v3 (GPL + * Version 3), copied verbatim in the file "COPYING". + * + * See http://alice-o2.web.cern.ch/license for full licensing information. + * + * In applying this license CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization + * or submit itself to any jurisdiction. + */ + +import {Observable, RemoteData} from '/js/src/index.js'; + +/** + * Model to store the state of the page representing calibration runs and associated actions + */ +export class CalibrationRunsModel extends Observable { + /** + * Constructor + * @param {Model} model - the global model + */ + constructor(model) { + super(); + + /** + * @type {Model} + */ + this._model = model; + + /** + * Object containing list of calibration runs grouped by their detector + * @example + * RemoteData { + * "TPC": [ + * {}, + * {} + * ] + * } + */ + this._calibrationRuns = RemoteData.notAsked(); + } + + /** + * Initialize model for environment creation page + */ + async initPage() { + this._calibrationRuns = RemoteData.loading(); + this.notify(); + + const {result, ok} = await this._model.loader.get('/api/runs/calibration'); + this._calibrationRuns = ok ? RemoteData.success(result) : RemoteData.failure(result.message); + + this.notify(); + } + + /** + * Getters & Setters + */ + + /** + * Returns a RemoteData Object which wraps the reply of the server: + * - a list of calibration runs grouped by detector + * - an error message + * @return {RemoteData} + */ + get calibrationRuns() { + return this._calibrationRuns; + } +} diff --git a/Control/public/pages/CalibrationRuns/CalibrationRuns.page.js b/Control/public/pages/CalibrationRuns/CalibrationRuns.page.js new file mode 100644 index 000000000..cbc61cbef --- /dev/null +++ b/Control/public/pages/CalibrationRuns/CalibrationRuns.page.js @@ -0,0 +1,34 @@ +/** + * @license + * Copyright CERN and copyright holders of ALICE O2. This software is + * distributed under the terms of the GNU General Public License v3 (GPL + * Version 3), copied verbatim in the file "COPYING". + * + * See http://alice-o2.web.cern.ch/license for full licensing information. + * + * In applying this license CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization + * or submit itself to any jurisdiction. + */ + +import {h} from '/js/src/index.js'; +import {calibrationRunsContent} from './components/calibrationRunsContent.js'; + +/** + * Header for the simplified creation environment page + * @returns {vnode} + */ +export const CalibrationRunsHeader = () => h('h4.w-100 text-center', 'Calibration Runs'); + +/** + * Page for displaying calibration runs and related actions + * + * @param {Model} model - the global model + * @return {vnode} - main component for the creation page of an environment + */ +export const CalibrationRunsContent = (model) => { + const {calibrationRunsModel} = model; + + return h('.absolute-fill.scroll-y', calibrationRunsContent(calibrationRunsModel) + ); +}; diff --git a/Control/public/pages/CalibrationRuns/components/calibrationRunCard.js b/Control/public/pages/CalibrationRuns/components/calibrationRunCard.js new file mode 100644 index 000000000..07f4df666 --- /dev/null +++ b/Control/public/pages/CalibrationRuns/components/calibrationRunCard.js @@ -0,0 +1,30 @@ +/** + * @license + * Copyright 2019-2020 CERN and copyright holders of ALICE O2. + * See http://alice-o2.web.cern.ch/copyright for details of the copyright holders. + * All rights not expressly granted are reserved. + * + * This software is distributed under the terms of the GNU General Public + * License v3 (GPL Version 3), copied verbatim in the file "COPYING". + * + * In applying this license CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization + * or submit itself to any jurisdiction. +*/ + +import {formatTimeDuration} from '/js/src/index.js'; +import {rowForCard} from '../../../common/card/rowForCard.js'; +import {miniCard} from './../../../common/card/miniCard.js'; +import {calibrationRunCardTitle} from './calibrationRunCardTitle.js'; + +/** + * Builds a card with information specific to a calibration run + * @param {RunSummary} run - information about the run + * @return {vnode} + */ +export const calibrationRunCard = (run) => miniCard( + calibrationRunCardTitle(run), [ + rowForCard(formatTimeDuration(run.runDuration), `Start: ${new Date(run.startTime).toLocaleString()}`), + rowForCard(null, `End: ${new Date(run.endTime).toLocaleString()}`), + ], ['w-30', 'g0', 'p2'] +); diff --git a/Control/public/pages/CalibrationRuns/components/calibrationRunCardTitle.js b/Control/public/pages/CalibrationRuns/components/calibrationRunCardTitle.js new file mode 100644 index 000000000..5cf6842bc --- /dev/null +++ b/Control/public/pages/CalibrationRuns/components/calibrationRunCardTitle.js @@ -0,0 +1,39 @@ +/** + * @license + * Copyright 2019-2020 CERN and copyright holders of ALICE O2. + * See http://alice-o2.web.cern.ch/copyright for details of the copyright holders. + * All rights not expressly granted are reserved. + * + * This software is distributed under the terms of the GNU General Public + * License v3 (GPL Version 3), copied verbatim in the file "COPYING". + * + * In applying this license CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization + * or submit itself to any jurisdiction. +*/ + +import {h} from '/js/src/index.js'; +import {coloredBadge} from './../../../common/coloredBadge.js'; +import {RUN_CALIBRATION_STATUS_COLOR_MAP} from './../../../common/enums/runCalibrationStatus.enum.js'; + +/* global COG */ + +/** + * Component for building the title component of a calibrationRunCard + * @return {vnode} + */ +export const calibrationRunCardTitle = (run) => + h('.flex-row.justify-between', [ + h('.flex-row.w-60', [ + h('a.f4.actionable-row', { + href: `${COG.BKP_URL}?page=run-detail&id=${run.id}`, + target: '_blank', + }, run.runNumber), + h('.f4.ph2', '/'), + h('a.f4.text-right.actionable-row', { + href: `${COG.BKP_URL}?page=env-details&environmentId=${run.environmentId}`, + target: '_blank', + }, run.environmentId) + ]), + coloredBadge(run.calibrationStatus, RUN_CALIBRATION_STATUS_COLOR_MAP), + ]); diff --git a/Control/public/pages/CalibrationRuns/components/calibrationRunGroups.js b/Control/public/pages/CalibrationRuns/components/calibrationRunGroups.js new file mode 100644 index 000000000..0af7861db --- /dev/null +++ b/Control/public/pages/CalibrationRuns/components/calibrationRunGroups.js @@ -0,0 +1,53 @@ +/** + * @license + * Copyright 2019-2020 CERN and copyright holders of ALICE O2. + * See http://alice-o2.web.cern.ch/copyright for details of the copyright holders. + * All rights not expressly granted are reserved. + * + * This software is distributed under the terms of the GNU General Public + * License v3 (GPL Version 3), copied verbatim in the file "COPYING". + * + * In applying this license CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization + * or submit itself to any jurisdiction. +*/ + +import {h} from '/js/src/index.js'; +import {miniCard} from '../../../common/card/miniCard.js'; +import {calibrationRunCard} from './calibrationRunCard.js'; + +/** + * @file contains grouped needed for displaying actions and information on calibration runs that are grouped + * by detector and runType. Each such group needs to have: + * - action panel for starting a new calibration run + * - last calibrationRunCard information + * - last successful calibrationRunCard information + */ + +/** + * Panel which contains all calibration runs data grouped by detector + * @param {Object} calibrationsRunsByDetector - object with calibration runs information grouped by their detector + * @return {vnode} + */ +export const groupedCalibrationRunsPanel = (calibrationsRunsByDetector) => { + const detectorsGroupPanel = []; + for (const detector in calibrationsRunsByDetector) { + const runsForDetector = calibrationsRunsByDetector[detector]; + detectorsGroupPanel.push(calibrationRunsPerDetectorCard(runsForDetector)); + } + return detectorsGroupPanel +}; + +/** + * Component for mapping each detector to its group of calibration runs + * @param {Array} runs - list of runs for which to build the components + * @return {vnode} + */ +const calibrationRunsPerDetectorCard = (runs) => + miniCard(null, [ + runs.map((run) => + h('.p1.flex-row.g2', [ + calibrationRunCard(run), + ]) + ) + ], ['m1', 'g1', 'p1']); diff --git a/Control/public/pages/CalibrationRuns/components/calibrationRunsContent.js b/Control/public/pages/CalibrationRuns/components/calibrationRunsContent.js new file mode 100644 index 000000000..f9c154fdd --- /dev/null +++ b/Control/public/pages/CalibrationRuns/components/calibrationRunsContent.js @@ -0,0 +1,37 @@ +/** + * @license + * Copyright 2019-2020 CERN and copyright holders of ALICE O2. + * See http://alice-o2.web.cern.ch/copyright for details of the copyright holders. + * All rights not expressly granted are reserved. + * + * This software is distributed under the terms of the GNU General Public + * License v3 (GPL Version 3), copied verbatim in the file "COPYING". + * + * In applying this license CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization + * or submit itself to any jurisdiction. +*/ + +import {h} from '/js/src/index.js'; +import errorPage from './../../../common/errorPage.js'; +import pageLoading from './../../../common/pageLoading.js'; +import {groupedCalibrationRunsPanel} from './calibrationRunGroups.js'; + +/** + * @file component which builds a panel for displaying actions and information on calibration runs + */ + +/** + * Main content panel of CalibrationRunPage containing multiple widgets grouped by their detector + * @param {CalibrationRunsModel} calibrationRunsModel - model for the calibration runs page + * @return {vnode} + */ +export const calibrationRunsContent = (calibrationRunsModel) => { + const {calibrationRuns} = calibrationRunsModel; + return calibrationRuns.match({ + NotAsked: () => h('.f7.flex-column', 'Calibration Runs data not asked'), + Loading: () => pageLoading(2), + Success: (runsGroupedByDetector) => groupedCalibrationRunsPanel(runsGroupedByDetector), + Failure: (error) => errorPage(error), + }) +}; diff --git a/Control/public/view.js b/Control/public/view.js index 20fd65b79..022b7723f 100644 --- a/Control/public/view.js +++ b/Control/public/view.js @@ -28,6 +28,10 @@ import { EnvironmentCreationHeader, EnvironmentCreationPage } from './pages/EnvironmentCreation/EnvironmentCreation.page.js'; +import { + CalibrationRunsHeader, + CalibrationRunsContent +} from './pages/CalibrationRuns/CalibrationRuns.page.js'; import { content as environmentsContent, header as environmentsHeader @@ -87,6 +91,7 @@ const header = (model) => h('.bg-white flex-row p2 shadow-level2 level2', [ switchCase(model.router.params.page, { newEnvironmentAdvanced: workflowsHeader, newEnvironment: EnvironmentCreationHeader, + calibrationRuns: CalibrationRunsHeader, environments: environmentsHeader, environment: environmentHeader, about: statusHeader, @@ -107,6 +112,7 @@ const content = (model) => [ switchCase(model.router.params.page, { newEnvironmentAdvanced: workflowsContent, newEnvironment: EnvironmentCreationPage, + calibrationRuns: CalibrationRunsContent, environments: environmentsContent, environment: environmentContent, about: statusContent, diff --git a/Control/test/lib/config/mocha-public-config.js b/Control/test/lib/config/mocha-public-config.js index 0ebc57f78..505368632 100644 --- a/Control/test/lib/config/mocha-public-config.js +++ b/Control/test/lib/config/mocha-public-config.js @@ -73,12 +73,12 @@ describe('Public Configuration Test Suite', () => { }); it('should successfully return empty string if configuration is missing for Bookkeeping', () => { - assert.strictEqual(_getBookkeepingURL({}), ''); - assert.strictEqual(_getBookkeepingURL(undefined), ''); - assert.strictEqual(_getBookkeepingURL({bookkeepingGui: {urlWrong: 'local'}}), ''); + assert.strictEqual(_getBookkeepingURL({}), null); + assert.strictEqual(_getBookkeepingURL(undefined), null); + assert.strictEqual(_getBookkeepingURL({bookkeeping: {urlWrong: 'local'}}), null); }); - it('should successfully return QCG URL as string if configuration is provided', () => { - assert.strictEqual(_getBookkeepingURL({bookkeepingGui: {url: 'localhost:8080'}}), 'localhost:8080'); + it('should successfully return BKP URL as string if configuration is provided', () => { + assert.deepStrictEqual(_getBookkeepingURL({bookkeeping: {url: 'localhost:8080'}}), new URL('localhost:8080')); }); }); diff --git a/Control/test/mocha-index.js b/Control/test/mocha-index.js index 7f6e2fd0c..273129c5a 100644 --- a/Control/test/mocha-index.js +++ b/Control/test/mocha-index.js @@ -128,7 +128,7 @@ describe('Control', function() { const expectedConf = { ILG_URL: 'http://localhost:8081', ILG_EPN_URL: 'http://localhost:8083', - BKP_URL: 'http://localhost:2021', + BKP_URL: 'http://localhost:2021/', QCG_URL: 'http://localhost:2022', GRAFANA: { status: true, diff --git a/Control/test/test-config.js b/Control/test/test-config.js index 6c78ca5b1..88cb10f29 100644 --- a/Control/test/test-config.js +++ b/Control/test/test-config.js @@ -55,9 +55,6 @@ module.exports = { grafana: { url: 'http://localhost:2020' }, - bookkeepingGui: { - url: 'http://localhost:2021' - }, bookkeeping: { url: 'http://localhost:2021', },