From 869c999ba0b0e5280e51ac4b5c4d1be2c31913fc Mon Sep 17 00:00:00 2001 From: xsalonx Date: Wed, 6 Aug 2025 13:41:29 +0200 Subject: [PATCH 01/22] fixes, refactor --- .../adapters/SimulationPassAdapter.js | 2 ++ .../ActiveColumns/dataPassesActiveColumns.js | 2 +- ...etInelasticInteractionRateActiveColumns.js | 28 +++++++++++++++++++ .../FixedPdpBeamTypeRunsOverviewModel.js | 12 ++++---- .../RunsPerDataPassOverviewPage.js | 19 +++---------- .../RunsPerLhcPeriodOverviewModel.js | 4 +-- .../RunsPerLhcPeriodOverviewPage.js | 18 ++---------- lib/public/views/Runs/RunsModel.js | 24 +++++++++------- .../RunsPerSimulationPassOverviewModel.js | 4 +-- .../RunsPerSimulationPassOverviewPage.js | 8 ++---- .../simulationPassesActiveColumns.js | 4 +-- .../ActiveColumns/lhcPeriodsActiveColumns.js | 4 +-- .../simulationPasses/SimulationPassService.js | 4 +++ 13 files changed, 73 insertions(+), 60 deletions(-) create mode 100644 lib/public/views/Runs/ActiveColumns/getInelasticInteractionRateActiveColumns.js diff --git a/lib/database/adapters/SimulationPassAdapter.js b/lib/database/adapters/SimulationPassAdapter.js index 214f850f55..d1ea633443 100644 --- a/lib/database/adapters/SimulationPassAdapter.js +++ b/lib/database/adapters/SimulationPassAdapter.js @@ -42,6 +42,7 @@ class SimulationPassAdapter { const dataPassesCount = databaseObject.get('dataPassesCount'); const runsCount = databaseObject.get('runsCount'); + const pdpBeamTypes = databaseObject.get('pdpBeamTypes'); return { id, @@ -54,6 +55,7 @@ class SimulationPassAdapter { outputSize, runsCount, dataPassesCount, + pdpBeamTypes, }; } } diff --git a/lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js b/lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js index 9223123473..2b13885e0d 100644 --- a/lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js +++ b/lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js @@ -52,7 +52,7 @@ export const dataPassesActiveColumns = { : frontLink( badge(runsCount), 'runs-per-data-pass', - { dataPassId: id, pdpBeamType }, + { dataPassId: id, pdpBeamTypes: pdpBeamType }, ), classes: 'w-10', }, diff --git a/lib/public/views/Runs/ActiveColumns/getInelasticInteractionRateActiveColumns.js b/lib/public/views/Runs/ActiveColumns/getInelasticInteractionRateActiveColumns.js new file mode 100644 index 0000000000..f1a820aa36 --- /dev/null +++ b/lib/public/views/Runs/ActiveColumns/getInelasticInteractionRateActiveColumns.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 { PdpBeamType } from '../../../domain/enums/PdpBeamType.js'; +import { inelasticInteractionRateActiveColumnsForPbPb as inelForPbPb } from './inelasticInteractionRateActiveColumnsForPbPb.js'; +import { inelasticInteractionRateActiveColumnsForProtonProton as inelForPP } from './inelasticInteractionRateActiveColumnsForProtonProton.js'; + +/** + * Get appropriate runs' activate columns dependent on their pdp beam types + * + * @param {string[]} pdpBeamTypes lit of pdp beam types + * @return {ActiveColumn} active column + */ +export const getInelasticInteractionRateColumns = (pdpBeamTypes) => ({ + ...pdpBeamTypes.includes(PdpBeamType.LEAD_LEAD) ? inelForPbPb : {}, + ...pdpBeamTypes.includes(PdpBeamType.PROTON_PROTON) ? inelForPP : {}, + ...pdpBeamTypes.length === 0 ? { ...inelForPP, ...inelForPbPb } : {}, +}); diff --git a/lib/public/views/Runs/Overview/FixedPdpBeamTypeRunsOverviewModel.js b/lib/public/views/Runs/Overview/FixedPdpBeamTypeRunsOverviewModel.js index 5fe3215406..9184cd3c24 100644 --- a/lib/public/views/Runs/Overview/FixedPdpBeamTypeRunsOverviewModel.js +++ b/lib/public/views/Runs/Overview/FixedPdpBeamTypeRunsOverviewModel.js @@ -26,24 +26,24 @@ export class FixedPdpBeamTypeRunsOverviewModel extends RunsWithQcModel { */ constructor(model) { super(model); - this._pdpBeamType = null; + this._pdpBeamTypes = null; } /** * Get pdp_beam_type of fetched runs * - * @return {string} beam type + * @return {string[]} beam type */ get pdpBeamTypes() { - return this._pdpBeamType; + return this._pdpBeamTypes; } /** * Set pdp_beam_type of fetched runs * - * @param {string} pdpBeamType beam type + * @param {string|string[]} pdpBeamTypes beam type */ - set pdpBeamTypes(pdpBeamType) { - this._pdpBeamType = pdpBeamType; + set pdpBeamTypes(pdpBeamTypes) { + this._pdpBeamTypes = typeof pdpBeamTypes === 'string' ? pdpBeamTypes.split(',') : pdpBeamTypes; } } diff --git a/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js b/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js index 15f58fd57e..e7ffe1b9fe 100644 --- a/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js +++ b/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js @@ -11,7 +11,7 @@ * or submit itself to any jurisdiction. */ -import { DropdownComponent, h, iconWarning, sessionService, switchCase } from '/js/src/index.js'; +import { DropdownComponent, h, iconWarning, sessionService } from '/js/src/index.js'; import { table } from '../../../components/common/table/table.js'; import { paginationComponent } from '../../../components/Pagination/paginationComponent.js'; import { estimateDisplayableRowsCount } from '../../../utilities/estimateDisplayableRowsCount.js'; @@ -21,8 +21,6 @@ import spinner from '../../../components/common/spinner.js'; import { tooltip } from '../../../components/common/popover/tooltip.js'; import { breadcrumbs } from '../../../components/common/navigation/breadcrumbs.js'; import { createRunDetectorsAsyncQcActiveColumns } from '../ActiveColumns/runDetectorsAsyncQcActiveColumns.js'; -import { inelasticInteractionRateActiveColumnsForPbPb } from '../ActiveColumns/inelasticInteractionRateActiveColumnsForPbPb.js'; -import { inelasticInteractionRateActiveColumnsForProtonProton } from '../ActiveColumns/inelasticInteractionRateActiveColumnsForProtonProton.js'; import { filtersPanelPopover } from '../../../components/Filters/common/filtersPanelPopover.js'; import { runNumbersFilter } from '../../../components/Filters/RunsFilter/runNumbersFilter.js'; import { qcSummaryLegendTooltip } from '../../../components/qcFlags/qcSummaryLegendTooltip.js'; @@ -39,6 +37,7 @@ import { mergeRemoteData } from '../../../utilities/mergeRemoteData.js'; import { numericalComparisonFilter } from '../../../components/Filters/common/filters/numericalComparisonFilter.js'; import { iconCaretBottom } from '/js/src/icons.js'; import { BkpRoles } from '../../../domain/enums/BkpRoles.js'; +import { getInelasticInteractionRateColumns } from '../ActiveColumns/getInelasticInteractionRateActiveColumns.js'; const TABLEROW_HEIGHT = 59; // Estimate of the navbar and pagination elements height total; Needs to be updated in case of changes; @@ -121,7 +120,7 @@ export const RunsPerDataPassOverviewPage = ({ dataPassId, sortModel, mcReproducibleAsNotBad, - pdpBeamType, + pdpBeamTypes, markAsSkimmableRequestResult, skimmableRuns: remoteSkimmableRuns, freezeOrUnfreezeActionState, @@ -140,17 +139,7 @@ export const RunsPerDataPassOverviewPage = ({ Success: ([dataPass, runs, detectors, qcSummary, gaqSummary]) => { const activeColumns = { ...runsActiveColumns, - ...switchCase( - pdpBeamType, - { - [PdpBeamType.PROTON_PROTON]: inelasticInteractionRateActiveColumnsForProtonProton, - [PdpBeamType.LEAD_LEAD]: inelasticInteractionRateActiveColumnsForPbPb, - }, - { - ...inelasticInteractionRateActiveColumnsForProtonProton, - ...inelasticInteractionRateActiveColumnsForPbPb, - }, - ), + ...getInelasticInteractionRateColumns(pdpBeamTypes), ...dataPass.skimmingStage === SkimmingStage.SKIMMABLE ? { readyForSkimming: { diff --git a/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewModel.js b/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewModel.js index 898fd3f97c..e8c83d1f2b 100644 --- a/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewModel.js +++ b/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewModel.js @@ -13,8 +13,8 @@ import { buildUrl, RemoteData } from '/js/src/index.js'; import { TabbedPanelModel } from '../../../components/TabbedPanel/TabbedPanelModel.js'; import { detectorsProvider } from '../../../services/detectors/detectorsProvider.js'; -import { RunsWithQcModel } from '../Overview/RunsWithQcModel.js'; import { jsonFetch } from '../../../utilities/fetch/jsonFetch.js'; +import { FixedPdpBeamTypeRunsOverviewModel } from '../Overview/FixedPdpBeamTypeRunsOverviewModel.js'; export const RUNS_PER_LHC_PERIOD_PANELS_KEYS = { DETECTOR_QUALITIES: 'detectorQualities', @@ -24,7 +24,7 @@ export const RUNS_PER_LHC_PERIOD_PANELS_KEYS = { /** * Runs Per LHC Period overview model */ -export class RunsPerLhcPeriodOverviewModel extends RunsWithQcModel { +export class RunsPerLhcPeriodOverviewModel extends FixedPdpBeamTypeRunsOverviewModel { /** * Constructor * diff --git a/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewPage.js b/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewPage.js index 1ae252ab85..d920c86d2c 100644 --- a/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewPage.js +++ b/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewPage.js @@ -18,13 +18,11 @@ import { estimateDisplayableRowsCount } from '../../../utilities/estimateDisplay import { exportRunsTriggerAndModal } from '../Overview/exportRunsTriggerAndModal.js'; import { runsActiveColumns } from '../ActiveColumns/runsActiveColumns.js'; import { runDetectorsQualitiesActiveColumns } from '../ActiveColumns/runDetectorsQualitiesActiveColumns.js'; -import { inelasticInteractionRateActiveColumnsForProtonProton } from '../ActiveColumns/inelasticInteractionRateActiveColumnsForProtonProton.js'; -import { inelasticInteractionRateActiveColumnsForPbPb } from '../ActiveColumns/inelasticInteractionRateActiveColumnsForPbPb.js'; import { isRunNotSubjectToQc } from '../../../components/qcFlags/isRunNotSubjectToQc.js'; import { runDetectorsSyncQcActiveColumns } from '../ActiveColumns/runDetectorsSyncQcActiveColumns.js'; import { tabbedPanelComponent } from '../../../components/TabbedPanel/tabbedPanelComponent.js'; import { RUNS_PER_LHC_PERIOD_PANELS_KEYS } from './RunsPerLhcPeriodOverviewModel.js'; -import { PdpBeamType } from '../../../domain/enums/PdpBeamType.js'; +import { getInelasticInteractionRateColumns } from '../ActiveColumns/getInelasticInteractionRateActiveColumns.js'; const TABLEROW_HEIGHT = 62; // Estimate of the navbar and pagination elements height total; Needs to be updated in case of changes; @@ -58,22 +56,12 @@ export const RunsPerLhcPeriodOverviewPage = ({ runs: { perLhcPeriodOverviewModel displayOptions, sortModel, tabbedPanelModel, + pdpBeamTypes, } = perLhcPeriodOverviewModel; const activeColumns = { ...runsActiveColumns, - ...remoteRuns.match({ - Success: (runs) => runs.some((run) => run.pdpBeamType === PdpBeamType.LEAD_LEAD) - ? inelasticInteractionRateActiveColumnsForPbPb - : {}, - Other: () => {}, - }), - ...remoteRuns.match({ - Success: (runs) => runs.some((run) => run.pdpBeamType === PdpBeamType.PROTON_PROTON) - ? inelasticInteractionRateActiveColumnsForProtonProton - : {}, - Other: () => {}, - }), + ...getInelasticInteractionRateColumns(pdpBeamTypes), }; /** diff --git a/lib/public/views/Runs/RunsModel.js b/lib/public/views/Runs/RunsModel.js index 88aec1ca89..ff4afb8451 100644 --- a/lib/public/views/Runs/RunsModel.js +++ b/lib/public/views/Runs/RunsModel.js @@ -85,14 +85,16 @@ export class RunsModel extends Observable { /** * Load runs overview data * @param {object} params the parameters for the model - * @param {string} [params.lhcPeriodName] the name of the LHC period to display - * @param {string} [params.panel] the key of the panel to display + * @param {string} params.lhcPeriodName the name of the LHC period to display + * @param {string} params.panel the key of the panel to display + * @param {string} params.pdpBeamTypes the key of the panel to display * @return {void} */ - loadPerLhcPeriodOverview({ lhcPeriodName, panel }) { + loadPerLhcPeriodOverview({ lhcPeriodName, panel, pdpBeamTypes }) { this._perLhcPeriodOverviewModel.tabbedPanelModel.currentPanelKey = panel; if (!this._perLhcPeriodOverviewModel.pagination.isInfiniteScrollEnabled) { this._perLhcPeriodOverviewModel.lhcPeriodName = lhcPeriodName; + this._perLhcPeriodOverviewModel.pdpBeamTypes = pdpBeamTypes; this._perLhcPeriodOverviewModel.load(); } } @@ -108,14 +110,14 @@ export class RunsModel extends Observable { /** * Load runs overview data * @param {object} params the parameters for the model - * @param {string} [params.dataPassId] the id of the data pass to display - * @param {string} [params.pdpBeamType] the beam type of the data pass to display + * @param {string} params.dataPassId the id of the data pass to display + * @param {string} params.pdpBeamTypes the beam types of the runs to display * @return {void} */ - loadPerDataPassOverview({ dataPassId, pdpBeamType }) { + loadPerDataPassOverview({ dataPassId, pdpBeamTypes }) { if (!this._perDataPassOverviewModel.pagination.isInfiniteScrollEnabled) { this._perDataPassOverviewModel.dataPassId = parseInt(dataPassId, 10); - this._perDataPassOverviewModel.pdpBeamType = pdpBeamType; + this._perDataPassOverviewModel.pdpBeamTypes = pdpBeamTypes; this._perDataPassOverviewModel.load(); } } @@ -130,13 +132,15 @@ export class RunsModel extends Observable { /** * Load runs overview per simulation pass data - * @param {object} root0 - The parameters for the model. - * @param {string} root0.simulationPassId - The ID of the simulation pass to load. + * @param {object} params - The parameters for the model. + * @param {string} params.simulationPassId - The ID of the simulation pass to load. + * @param {string} params.pdpBeamTypes the beam types of the runs to display * @return {void} */ - loadPerSimulationPassOverview({ simulationPassId }) { + loadPerSimulationPassOverview({ simulationPassId, pdpBeamTypes }) { if (!this._perSimulationPassOverviewModel.pagination.isInfiniteScrollEnabled) { this._perSimulationPassOverviewModel.simulationPassId = parseInt(simulationPassId, 10); + this._perSimulationPassOverviewModel.pdpBeamTypes = pdpBeamTypes; this._perSimulationPassOverviewModel.load(); } } diff --git a/lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewModel.js b/lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewModel.js index 38ab7edad1..dcd64943c7 100644 --- a/lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewModel.js +++ b/lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewModel.js @@ -11,16 +11,16 @@ * or submit itself to any jurisdiction. */ import { buildUrl, RemoteData } from '/js/src/index.js'; -import { RunsWithQcModel } from '../Overview/RunsWithQcModel.js'; import { ObservableData } from '../../../utilities/ObservableData.js'; import { getRemoteData } from '../../../utilities/fetch/getRemoteData.js'; import { detectorsProvider } from '../../../services/detectors/detectorsProvider.js'; import { RunDetectorsSelectionModel } from '../RunDetectorsSelectionModel.js'; +import { FixedPdpBeamTypeRunsOverviewModel } from '../Overview/FixedPdpBeamTypeRunsOverviewModel.js'; /** * Runs Per Simulation Pass overview model */ -export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel { +export class RunsPerSimulationPassOverviewModel extends FixedPdpBeamTypeRunsOverviewModel { /** * Constructor * @param {Model} model global model diff --git a/lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewPage.js b/lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewPage.js index 1cf1287076..a5c799f35d 100644 --- a/lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewPage.js +++ b/lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewPage.js @@ -20,14 +20,12 @@ import { runsActiveColumns } from '../ActiveColumns/runsActiveColumns.js'; import { breadcrumbs } from '../../../components/common/navigation/breadcrumbs.js'; import spinner from '../../../components/common/spinner.js'; import { createRunDetectorsAsyncQcActiveColumns } from '../ActiveColumns/runDetectorsAsyncQcActiveColumns.js'; -import { inelasticInteractionRateActiveColumnsForPbPb } from '../ActiveColumns/inelasticInteractionRateActiveColumnsForPbPb.js'; -import { inelasticInteractionRateActiveColumnsForProtonProton } from '../ActiveColumns/inelasticInteractionRateActiveColumnsForProtonProton.js'; import { qcSummaryLegendTooltip } from '../../../components/qcFlags/qcSummaryLegendTooltip.js'; import { isRunNotSubjectToQc } from '../../../components/qcFlags/isRunNotSubjectToQc.js'; -import { PdpBeamType } from '../../../domain/enums/PdpBeamType.js'; import { frontLink } from '../../../components/common/navigation/frontLink.js'; import { mergeRemoteData } from '../../../utilities/mergeRemoteData.js'; import errorAlert from '../../../components/common/errorAlert.js'; +import { getInelasticInteractionRateColumns } from '../ActiveColumns/getInelasticInteractionRateActiveColumns.js'; const TABLEROW_HEIGHT = 59; // Estimate of the navbar and pagination elements height total; Needs to be updated in case of changes; @@ -64,6 +62,7 @@ export const RunsPerSimulationPassOverviewPage = ({ qcSummary: remoteQcSummary, displayOptions, sortModel, + pdpBeamTypes, } = perSimulationPassOverviewModel; const commonTitle = h('h2', 'Runs per MC'); @@ -74,8 +73,7 @@ export const RunsPerSimulationPassOverviewPage = ({ Success: ([simulationPass, runs, detectors, qcSummary]) => { const activeColumns = { ...runsActiveColumns, - ...runs.some((run) => run.pdpBeamType === PdpBeamType.LEAD_LEAD) ? inelasticInteractionRateActiveColumnsForPbPb : {}, - ...runs.some((run) => run.pdpBeamType === PdpBeamType.PROTON_PROTON) ? inelasticInteractionRateActiveColumnsForProtonProton : {}, + ...getInelasticInteractionRateColumns(pdpBeamTypes), ...createRunDetectorsAsyncQcActiveColumns( perSimulationPassOverviewModel.runDetectorsSelectionModel, detectors, diff --git a/lib/public/views/SimulationPasses/ActiveColumns/simulationPassesActiveColumns.js b/lib/public/views/SimulationPasses/ActiveColumns/simulationPassesActiveColumns.js index 32fcee388a..59b181f02e 100644 --- a/lib/public/views/SimulationPasses/ActiveColumns/simulationPassesActiveColumns.js +++ b/lib/public/views/SimulationPasses/ActiveColumns/simulationPassesActiveColumns.js @@ -37,13 +37,13 @@ export const simulationPassesActiveColumns = { associatedRuns: { name: 'Runs', visible: true, - format: (_, { id, runsCount }) => + format: (_, { id, runsCount, pdpBeamTypes }) => runsCount === 0 ? 'No runs' : frontLink( badge(runsCount), 'runs-per-simulation-pass', - { simulationPassId: id }, + { simulationPassId: id, pdpBeamTypes }, ), classes: 'w-10 f6', }, diff --git a/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js b/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js index 125cb30c2c..6814f5bbf5 100644 --- a/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js +++ b/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js @@ -40,13 +40,13 @@ export const lhcPeriodsActiveColumns = { associatedRuns: { name: 'Runs', visible: true, - format: (_, { name, runsCount }) => + format: (_, { name, runsCount, beamTypes }) => runsCount === 0 ? 'No runs' : frontLink( badge(runsCount), 'runs-per-lhc-period', - { lhcPeriodName: name }, + { lhcPeriodName: name, pdpBeamTypes: beamTypes.join(',') }, ), classes: 'w-10', }, diff --git a/lib/server/services/simulationPasses/SimulationPassService.js b/lib/server/services/simulationPasses/SimulationPassService.js index ef4d410ee7..957a7ff3a5 100644 --- a/lib/server/services/simulationPasses/SimulationPassService.js +++ b/lib/server/services/simulationPasses/SimulationPassService.js @@ -140,6 +140,10 @@ class SimulationPassService { query: (sequelize) => sequelize.fn('count', sequelize.fn('distinct', sequelize.col('dataPasses.id'))), alias: 'dataPassesCount', }) + .includeAttribute({ + query: (sequelize) => sequelize.fn('GROUP_CONCAT', sequelize.fn('DISTINCT', sequelize.col('runs.pdp_beam_type'))), + alias: 'pdpBeamTypes', + }) .include({ association: 'runs', through: { attributes: [] }, From 43c1d629ff846b2f5beee7d6c8771c180a51c0c6 Mon Sep 17 00:00:00 2001 From: xsalonx Date: Wed, 6 Aug 2025 13:46:47 +0200 Subject: [PATCH 02/22] rename --- .../adapters/LhcPeriodStatisticsAdapter.js | 4 ++-- .../typedefs/SequelizeLhcPeriodStatistics.js | 2 +- lib/domain/entities/LhcPeriodStatistics.js | 2 +- .../ActiveColumns/lhcPeriodsActiveColumns.js | 12 ++++++------ .../lhcPeriods/Overview/LhcPeriodsOverviewModel.js | 14 +++++++------- .../controllers/lhcPeriodStatistics.controller.js | 4 ++-- .../lhcPeriod/LhcPeriodStatisticsService.js | 12 ++++++------ test/api/lhcPeriodsStatistics.test.js | 14 +++++++------- .../lhcPeriod/LhcPeriodStatisticsService.test.js | 14 +++++++------- test/public/lhcPeriods/overview.test.js | 4 ++-- test/public/runs/dataPassesUtilities.js | 2 +- 11 files changed, 42 insertions(+), 42 deletions(-) diff --git a/lib/database/adapters/LhcPeriodStatisticsAdapter.js b/lib/database/adapters/LhcPeriodStatisticsAdapter.js index 06982fd247..858b82175d 100644 --- a/lib/database/adapters/LhcPeriodStatisticsAdapter.js +++ b/lib/database/adapters/LhcPeriodStatisticsAdapter.js @@ -34,7 +34,7 @@ class LhcPeriodStatisticsAdapter { const runsCount = databaseObject.get('runsCount'); const distinctEnergies = databaseObject.get('distinctEnergies')?.split(',').map((energy) => parseFloat(energy)) || []; - const beamTypes = databaseObject.get('beamTypes')?.split(',') || []; + const pdpBeamTypes = databaseObject.get('pdpBeamTypes')?.split(',') || []; const dataPassesCount = databaseObject.get('dataPassesCount'); const simulationPassesCount = databaseObject.get('simulationPassesCount'); @@ -43,7 +43,7 @@ class LhcPeriodStatisticsAdapter { avgCenterOfMassEnergy, runsCount, distinctEnergies, - beamTypes, + pdpBeamTypes, dataPassesCount, simulationPassesCount, lhcPeriod: lhcPeriod ? this.lhcPeriodAdapter.toEntity(lhcPeriod) : null, diff --git a/lib/database/models/typedefs/SequelizeLhcPeriodStatistics.js b/lib/database/models/typedefs/SequelizeLhcPeriodStatistics.js index 1d172b0383..072e2811b0 100644 --- a/lib/database/models/typedefs/SequelizeLhcPeriodStatistics.js +++ b/lib/database/models/typedefs/SequelizeLhcPeriodStatistics.js @@ -17,7 +17,7 @@ * @property {number} id * @property {number|null} avgCenterOfMassEnergy * @property {number[]} distinctEnergies - * @property {string[]} beamTypes + * @property {string[]} pdpBeamTypes * @property {number} runsCount * @property {number} dataPassesCount * @property {number} simulationPassesCount diff --git a/lib/domain/entities/LhcPeriodStatistics.js b/lib/domain/entities/LhcPeriodStatistics.js index b45f13d843..40716c3365 100644 --- a/lib/domain/entities/LhcPeriodStatistics.js +++ b/lib/domain/entities/LhcPeriodStatistics.js @@ -17,7 +17,7 @@ * @property {number} id * @property {LhcPeriod} lhcPeriod * @property {number[]|null} distinctEnergies - * @property {string[]} beamTypes + * @property {string[]} pdpBeamTypes * @property {number} runsCount * @property {number} dataPassesCount * @property {number} simulationPassesCount diff --git a/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js b/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js index 6814f5bbf5..282d359eab 100644 --- a/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js +++ b/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js @@ -40,13 +40,13 @@ export const lhcPeriodsActiveColumns = { associatedRuns: { name: 'Runs', visible: true, - format: (_, { name, runsCount, beamTypes }) => + format: (_, { name, runsCount, pdpBeamTypes }) => runsCount === 0 ? 'No runs' : frontLink( badge(runsCount), 'runs-per-lhc-period', - { lhcPeriodName: name, pdpBeamTypes: beamTypes.join(',') }, + { lhcPeriodName: name, pdpBeamTypes: pdpBeamTypes.join(',') }, ), classes: 'w-10', }, @@ -99,13 +99,13 @@ export const lhcPeriodsActiveColumns = { classes: 'w-7', }, - beamTypes: { + pdpBeamTypes: { name: 'Beam Type', visible: true, sortable: true, - format: (beamTypes) => beamTypes.length > 0 ? beamTypes.join(',') : '-', - filter: ({ beamTypesFilterModel }) => textFilter( - beamTypesFilterModel, + format: (pdpBeamTypes) => pdpBeamTypes.length > 0 ? pdpBeamTypes.join(',') : '-', + filter: ({ pdpBeamTypesFilterModel }) => textFilter( + pdpBeamTypesFilterModel, { class: 'w-75 mt1', placeholder: 'e.g. pp, PbPb' }, ), classes: 'w-7', diff --git a/lib/public/views/lhcPeriods/Overview/LhcPeriodsOverviewModel.js b/lib/public/views/lhcPeriods/Overview/LhcPeriodsOverviewModel.js index f26d52bac2..eb2d5e48cd 100644 --- a/lib/public/views/lhcPeriods/Overview/LhcPeriodsOverviewModel.js +++ b/lib/public/views/lhcPeriods/Overview/LhcPeriodsOverviewModel.js @@ -31,8 +31,8 @@ export class LhcPeriodsOverviewModel extends OverviewPageModel { this._registerFilter(this._namesFilterModel); this._yearsFilterModel = new TextTokensFilterModel(); this._registerFilter(this._yearsFilterModel); - this._beamTypesFilterModel = new TextTokensFilterModel(); - this._registerFilter(this._beamTypesFilterModel); + this._pdpBeamTypesFilterModel = new TextTokensFilterModel(); + this._registerFilter(this._pdpBeamTypesFilterModel); } /** @@ -43,7 +43,7 @@ export class LhcPeriodsOverviewModel extends OverviewPageModel { filter: { names: this._namesFilterModel.normalized, years: this._yearsFilterModel.normalized, - beamTypes: this._beamTypesFilterModel.normalized, + pdpBeamTypes: this._pdpBeamTypesFilterModel.normalized, }, }; @@ -86,8 +86,8 @@ export class LhcPeriodsOverviewModel extends OverviewPageModel { * Returns lhc periods beam type filter model * @return {TextTokensFilterModel} lhc periods beam type filter model */ - get beamTypesFilterModel() { - return this._beamTypesFilterModel; + get pdpBeamTypesFilterModel() { + return this._pdpBeamTypesFilterModel; } /** @@ -99,7 +99,7 @@ export class LhcPeriodsOverviewModel extends OverviewPageModel { super.reset(); this._namesFilterModel.reset(); this._yearsFilterModel.reset(); - this._beamTypesFilterModel.reset(); + this._pdpBeamTypesFilterModel.reset(); } /** @@ -121,6 +121,6 @@ export class LhcPeriodsOverviewModel extends OverviewPageModel { * @return {boolean} true if any filter is active */ isAnyFilterActive() { - return !this._namesFilterModel.isEmpty || !this._yearsFilterModel.isEmpty || !this._beamTypesFilterModel.isEmpty; + return !this._namesFilterModel.isEmpty || !this._yearsFilterModel.isEmpty || !this._pdpBeamTypesFilterModel.isEmpty; } } diff --git a/lib/server/controllers/lhcPeriodStatistics.controller.js b/lib/server/controllers/lhcPeriodStatistics.controller.js index 229ecebf44..c70b04b67c 100644 --- a/lib/server/controllers/lhcPeriodStatistics.controller.js +++ b/lib/server/controllers/lhcPeriodStatistics.controller.js @@ -32,10 +32,10 @@ const listLhcPeriodStatisticsHandler = async (req, res) => { ids: Joi.array().items(Joi.number()), names: Joi.array().items(Joi.string()), years: Joi.array().items(Joi.number()), - beamTypes: Joi.array().items(Joi.string()), + pdpBeamTypes: Joi.array().items(Joi.string()), }, page: PaginationDto, - sort: DtoFactory.order(['id', 'name', 'avgCenterOfMassEnergy', 'year', 'beamTypes']), + sort: DtoFactory.order(['id', 'name', 'avgCenterOfMassEnergy', 'year', 'pdpBeamTypes']), }), req, res, diff --git a/lib/server/services/lhcPeriod/LhcPeriodStatisticsService.js b/lib/server/services/lhcPeriod/LhcPeriodStatisticsService.js index de58c087b1..da840628b9 100644 --- a/lib/server/services/lhcPeriod/LhcPeriodStatisticsService.js +++ b/lib/server/services/lhcPeriod/LhcPeriodStatisticsService.js @@ -96,8 +96,8 @@ class LhcPeriodStatisticsService { case 'year': expression = (sequelize) => sequelize.literal('SUBSTRING(lhcPeriod.name, 4, 2)'); break; - case 'beamTypes': - expression = (sequelize) => sequelize.literal('beamTypes'); + case 'pdpBeamTypes': + expression = (sequelize) => sequelize.literal('pdpBeamTypes'); break; } @@ -113,7 +113,7 @@ class LhcPeriodStatisticsService { } if (filter) { - const { ids, names, years, beamTypes } = filter; + const { ids, names, years, pdpBeamTypes } = filter; if (ids) { queryBuilder.where('id').oneOf(...ids); } @@ -126,7 +126,7 @@ class LhcPeriodStatisticsService { { years }, ); } - if (beamTypes) { + if (pdpBeamTypes) { const targetIds = (await LhcPeriodStatisticsRepository.findAll({ raw: true, include: { @@ -136,7 +136,7 @@ class LhcPeriodStatisticsService { association: 'runs', required: true, where: { - pdpBeamType: { [Op.in]: beamTypes }, + pdpBeamType: { [Op.in]: pdpBeamTypes }, definition: RunDefinition.PHYSICS, runQuality: RunQualities.GOOD, }, @@ -183,7 +183,7 @@ class LhcPeriodStatisticsService { }) .includeAttribute({ query: (sequelize) => sequelize.fn('GROUP_CONCAT', sequelize.fn('DISTINCT', sequelize.col('lhcPeriod->runs.pdp_beam_type'))), - alias: 'beamTypes', + alias: 'pdpBeamTypes', }) .include({ association: 'lhcPeriod', diff --git a/test/api/lhcPeriodsStatistics.test.js b/test/api/lhcPeriodsStatistics.test.js index 481cc1bbc5..01769182c1 100644 --- a/test/api/lhcPeriodsStatistics.test.js +++ b/test/api/lhcPeriodsStatistics.test.js @@ -23,7 +23,7 @@ const lhcPeriod_LHC22a = { id: 1, name: 'LHC22a', }, - beamTypes: ['PbPb'], + pdpBeamTypes: ['PbPb'], distinctEnergies: [ 23.21, 56.1, @@ -40,7 +40,7 @@ const lhcPeriod_LHC22b = { id: 2, name: 'LHC22b', }, - beamTypes: ['pp'], + pdpBeamTypes: ['pp'], distinctEnergies: [55.2], runsCount: 4, dataPassesCount: 3, @@ -54,7 +54,7 @@ const lhcPeriod_LHC23f = { id: 3, name: 'LHC23f', }, - beamTypes: [], + pdpBeamTypes: [], distinctEnergies: [], dataPassesCount: 0, runsCount: 0, @@ -186,9 +186,9 @@ module.exports = () => { done(); }); }); - it('should successfully filter on beamTypes', (done) => { + it('should successfully filter on pdpBeamTypes', (done) => { request(server) - .get('/api/lhcPeriodsStatistics?filter[beamTypes][]=pp') + .get('/api/lhcPeriodsStatistics?filter[pdpBeamTypes][]=pp') .expect(200) .end((err, res) => { if (err) { @@ -244,9 +244,9 @@ module.exports = () => { done(); }); }); - it('should successfully sort on beamTypes', (done) => { + it('should successfully sort on pdpBeamTypes', (done) => { request(server) - .get('/api/lhcPeriodsStatistics?sort[beamTypes]=DESC') + .get('/api/lhcPeriodsStatistics?sort[pdpBeamTypes]=DESC') .expect(200) .end((err, res) => { if (err) { diff --git a/test/lib/server/services/lhcPeriod/LhcPeriodStatisticsService.test.js b/test/lib/server/services/lhcPeriod/LhcPeriodStatisticsService.test.js index 604f2fba52..244d178c13 100644 --- a/test/lib/server/services/lhcPeriod/LhcPeriodStatisticsService.test.js +++ b/test/lib/server/services/lhcPeriod/LhcPeriodStatisticsService.test.js @@ -24,7 +24,7 @@ const lhcPeriod_LHC22a = { id: 1, name: 'LHC22a', }, - beamTypes: ['PbPb'], + pdpBeamTypes: ['PbPb'], distinctEnergies: [ 23.21, 56.1, @@ -41,7 +41,7 @@ const lhcPeriod_LHC22b = { id: 2, name: 'LHC22b', }, - beamTypes: ['pp'], + pdpBeamTypes: ['pp'], distinctEnergies: [55.2], runsCount: 4, dataPassesCount: 3, @@ -55,7 +55,7 @@ const lhcPeriod_LHC23f = { id: 3, name: 'LHC23f', }, - beamTypes: [], + pdpBeamTypes: [], distinctEnergies: [], dataPassesCount: 0, runsCount: 0, @@ -155,11 +155,11 @@ module.exports = () => { expect(lhcPeriods[2]).to.be.eql(lhcPeriod_LHC23f); }); - it('should successfully filter period statistics on beamTypes', async () => { + it('should successfully filter period statistics on pdpBeamTypes', async () => { const dto = { query: { filter: { - beamTypes: ['pp'], + pdpBeamTypes: ['pp'], }, }, }; @@ -168,11 +168,11 @@ module.exports = () => { expect(lhcPeriods).to.have.deep.members([lhcPeriod_LHC22b]); }); - it('should successfully sort period statistics on beamTypes', async () => { + it('should successfully sort period statistics on pdpBeamTypes', async () => { const dto = { query: { sort: { - beamTypes: 'ASC', + pdpBeamTypes: 'ASC', }, }, }; diff --git a/test/public/lhcPeriods/overview.test.js b/test/public/lhcPeriods/overview.test.js index 32555fce34..65535ece14 100644 --- a/test/public/lhcPeriods/overview.test.js +++ b/test/public/lhcPeriods/overview.test.js @@ -63,7 +63,7 @@ module.exports = () => { associatedDataPasses: (display) => /(No data passes)|(\d+)/.test(display), associatedSimulationPasses: (display) => /(No MC)|(\d+)/.test(display), year: (year) => !isNaN(year), - beamTypes: (beamTypes) => beamTypes.split(',').every((type) => allowedBeamTypesDisplays.has(type)), + pdpBeamTypes: (pdpBeamTypes) => pdpBeamTypes.split(',').every((type) => allowedBeamTypesDisplays.has(type)), avgCenterOfMassEnergy: (avgCenterOfMassEnergy) => avgCenterOfMassEnergy === '-' || !isNaN(avgCenterOfMassEnergy), distinctEnergies: (distinctEnergies) => distinctEnergies === '-' || distinctEnergies @@ -150,6 +150,6 @@ module.exports = () => { await page.waitForSelector('#reset-filters:disabled'); await fillInput(page, 'div.flex-row.items-baseline:nth-of-type(3) input[type=text]', 'PbPb'); await page.waitForSelector('#reset-filters:disabled', { hidden: true, timeout: 250 }); - await expectColumnValues(page, 'beamTypes', ['PbPb']); + await expectColumnValues(page, 'pdpBeamTypes', ['PbPb']); }); }; diff --git a/test/public/runs/dataPassesUtilities.js b/test/public/runs/dataPassesUtilities.js index 2b97b2f0d4..a1e0b53c3d 100644 --- a/test/public/runs/dataPassesUtilities.js +++ b/test/public/runs/dataPassesUtilities.js @@ -11,7 +11,7 @@ const { waitForNavigation, pressElement, getInnerText, expectUrlParams, waitForT */ exports.navigateToRunsPerDataPass = async (page, lhcPeriodId, dataPassId, expectedRowsCount) => { await waitForNavigation(page, () => pressElement(page, 'a#lhc-period-overview', true)); - const pdpBeamType = await getInnerText(await page.waitForSelector(`#row${lhcPeriodId}-beamTypes`)); + const pdpBeamType = await getInnerText(await page.waitForSelector(`#row${lhcPeriodId}-pdpBeamTypes`)); await waitForNavigation(page, () => pressElement(page, `#row${lhcPeriodId}-associatedDataPasses a`, true)); expectUrlParams(page, { page: 'data-passes-per-lhc-period-overview', lhcPeriodId }); await page.waitForSelector('th#description'); From 006710bd194123c80fe5736e0813d35bd3531a2e Mon Sep 17 00:00:00 2001 From: xsalonx Date: Wed, 6 Aug 2025 13:59:42 +0200 Subject: [PATCH 03/22] rename --- lib/database/adapters/DataPassAdapter.js | 4 ++-- .../views/DataPasses/ActiveColumns/dataPassesActiveColumns.js | 4 ++-- .../views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js | 2 +- lib/server/services/dataPasses/DataPassService.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/database/adapters/DataPassAdapter.js b/lib/database/adapters/DataPassAdapter.js index d4ca53fd80..68726f71a6 100644 --- a/lib/database/adapters/DataPassAdapter.js +++ b/lib/database/adapters/DataPassAdapter.js @@ -40,14 +40,14 @@ class DataPassAdapter { const runsCount = databaseObject.get('runsCount'); const simulationPassesCount = databaseObject.get('simulationPassesCount'); - const pdpBeamType = databaseObject.get('pdpBeamType'); + const pdpBeamTypes = databaseObject.get('pdpBeamTypes'); return { id, name, skimmingStage, versions: (versions ?? []).map(this.dataPassVersionAdapter.toEntity), - pdpBeamType, + pdpBeamTypes, runsCount, simulationPassesCount, isFrozen, diff --git a/lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js b/lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js index 2b13885e0d..191456db30 100644 --- a/lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js +++ b/lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js @@ -46,13 +46,13 @@ export const dataPassesActiveColumns = { associatedRuns: { name: 'Runs', visible: true, - format: (_, { id, runsCount, pdpBeamType }) => + format: (_, { id, runsCount, pdpBeamTypes }) => runsCount === 0 ? 'No runs' : frontLink( badge(runsCount), 'runs-per-data-pass', - { dataPassId: id, pdpBeamTypes: pdpBeamType }, + { dataPassId: id, pdpBeamTypes }, ), classes: 'w-10', }, diff --git a/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js b/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js index 282d359eab..473ac5578d 100644 --- a/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js +++ b/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js @@ -46,7 +46,7 @@ export const lhcPeriodsActiveColumns = { : frontLink( badge(runsCount), 'runs-per-lhc-period', - { lhcPeriodName: name, pdpBeamTypes: pdpBeamTypes.join(',') }, + { lhcPeriodName: name, pdpBeamTypes }, ), classes: 'w-10', }, diff --git a/lib/server/services/dataPasses/DataPassService.js b/lib/server/services/dataPasses/DataPassService.js index 7390366d89..0209815b32 100644 --- a/lib/server/services/dataPasses/DataPassService.js +++ b/lib/server/services/dataPasses/DataPassService.js @@ -273,7 +273,7 @@ class DataPassService { }) .includeAttribute({ query: (sequelize) => sequelize.fn('GROUP_CONCAT', sequelize.fn('DISTINCT', sequelize.col('runs.pdp_beam_type'))), - alias: 'pdpBeamType', + alias: 'pdpBeamTypes', }) .include({ association: 'runs', From ac3e267a0c3227cce0ad978a35f697867e2728f6 Mon Sep 17 00:00:00 2001 From: xsalonx Date: Wed, 6 Aug 2025 16:42:17 +0200 Subject: [PATCH 04/22] renames --- lib/database/adapters/DataPassAdapter.js | 2 +- lib/database/adapters/LhcPeriodStatisticsAdapter.js | 2 +- lib/database/adapters/SimulationPassAdapter.js | 2 +- .../getInelasticInteractionRateActiveColumns.js | 6 +++--- test/api/dataPasses.test.js | 2 +- test/api/index.js | 2 +- test/api/simulationPasses.test.js | 3 +++ test/lib/server/services/dataPasses/DataPassService.test.js | 2 +- .../simulationPasses/SimulationPassesService.test.js | 3 +++ 9 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/database/adapters/DataPassAdapter.js b/lib/database/adapters/DataPassAdapter.js index 68726f71a6..bc08bb2e6f 100644 --- a/lib/database/adapters/DataPassAdapter.js +++ b/lib/database/adapters/DataPassAdapter.js @@ -47,7 +47,7 @@ class DataPassAdapter { name, skimmingStage, versions: (versions ?? []).map(this.dataPassVersionAdapter.toEntity), - pdpBeamTypes, + pdpBeamTypes: pdpBeamTypes?.split(',') ?? [], runsCount, simulationPassesCount, isFrozen, diff --git a/lib/database/adapters/LhcPeriodStatisticsAdapter.js b/lib/database/adapters/LhcPeriodStatisticsAdapter.js index 858b82175d..275e79d417 100644 --- a/lib/database/adapters/LhcPeriodStatisticsAdapter.js +++ b/lib/database/adapters/LhcPeriodStatisticsAdapter.js @@ -43,7 +43,7 @@ class LhcPeriodStatisticsAdapter { avgCenterOfMassEnergy, runsCount, distinctEnergies, - pdpBeamTypes, + pdpBeamTypes: pdpBeamTypes?.split(',') ?? [], dataPassesCount, simulationPassesCount, lhcPeriod: lhcPeriod ? this.lhcPeriodAdapter.toEntity(lhcPeriod) : null, diff --git a/lib/database/adapters/SimulationPassAdapter.js b/lib/database/adapters/SimulationPassAdapter.js index d1ea633443..7f8b5aa955 100644 --- a/lib/database/adapters/SimulationPassAdapter.js +++ b/lib/database/adapters/SimulationPassAdapter.js @@ -55,7 +55,7 @@ class SimulationPassAdapter { outputSize, runsCount, dataPassesCount, - pdpBeamTypes, + pdpBeamTypes: pdpBeamTypes?.split(',') ?? [], }; } } diff --git a/lib/public/views/Runs/ActiveColumns/getInelasticInteractionRateActiveColumns.js b/lib/public/views/Runs/ActiveColumns/getInelasticInteractionRateActiveColumns.js index f1a820aa36..e3a9d70b2f 100644 --- a/lib/public/views/Runs/ActiveColumns/getInelasticInteractionRateActiveColumns.js +++ b/lib/public/views/Runs/ActiveColumns/getInelasticInteractionRateActiveColumns.js @@ -22,7 +22,7 @@ import { inelasticInteractionRateActiveColumnsForProtonProton as inelForPP } fro * @return {ActiveColumn} active column */ export const getInelasticInteractionRateColumns = (pdpBeamTypes) => ({ - ...pdpBeamTypes.includes(PdpBeamType.LEAD_LEAD) ? inelForPbPb : {}, - ...pdpBeamTypes.includes(PdpBeamType.PROTON_PROTON) ? inelForPP : {}, - ...pdpBeamTypes.length === 0 ? { ...inelForPP, ...inelForPbPb } : {}, + ...pdpBeamTypes?.includes(PdpBeamType.LEAD_LEAD) ? inelForPbPb : {}, + ...pdpBeamTypes?.includes(PdpBeamType.PROTON_PROTON) ? inelForPP : {}, + ...pdpBeamTypes?.length === 0 ? { ...inelForPP, ...inelForPbPb } : {}, }); diff --git a/test/api/dataPasses.test.js b/test/api/dataPasses.test.js index 018c8f3d07..2040fc5d13 100644 --- a/test/api/dataPasses.test.js +++ b/test/api/dataPasses.test.js @@ -25,7 +25,7 @@ const { BkpRoles } = require('../../lib/domain/enums/BkpRoles.js'); const LHC22b_apass1 = { id: 1, name: 'LHC22b_apass1', - pdpBeamType: 'pp', + pdpBeamTypes: ['pp'], skimmingStage: SkimmingStage.SKIMMABLE, isFrozen: false, versions: [ diff --git a/test/api/index.js b/test/api/index.js index c318e90e2a..e368ca5e61 100644 --- a/test/api/index.js +++ b/test/api/index.js @@ -56,7 +56,7 @@ module.exports = () => { describe('Tags API', TagsSuite); describe('LhcPeriodsStatistics API', LhcPeriodsStatisticsSuite); describe('DataPasses API', DataPassesSuite); - describe('SimulationPassesSuite API', SimulationPassesSuite); + describe('SimulationPasses API', SimulationPassesSuite); describe('DplDetectors API', DplDetectorsSuite); describe('QcFlagTypes API', QcFlagTypesSuite); describe('QcFlags API', QcFlagsSuite); diff --git a/test/api/simulationPasses.test.js b/test/api/simulationPasses.test.js index 56dab799a2..b707b213ef 100644 --- a/test/api/simulationPasses.test.js +++ b/test/api/simulationPasses.test.js @@ -20,6 +20,7 @@ const LHC23k6c = { id: 1, name: 'LHC23k6c', jiraId: 'SIMTICKET-1', + pdpBeamTypes: ['pp'], description: 'Some Random general purpose for LHC23k6c', pwg: 'PWGX2', requestedEventsCount: 1345555, @@ -33,6 +34,7 @@ const LHC23k6b = { id: 2, name: 'LHC23k6b', jiraId: 'SIMTICKET-2', + pdpBeamTypes: ['pp'], description: 'Some Random general purpose for LHC23k6b', pwg: 'PWGX1', requestedEventsCount: 2345555, @@ -46,6 +48,7 @@ const LHC23k6a = { id: 3, name: 'LHC23k6a', jiraId: 'SIMTICKET-3', + pdpBeamTypes: ['pp'], description: 'Some Random general purpose for LHC23k6a', pwg: 'PWGX3', requestedEventsCount: 2245555, diff --git a/test/lib/server/services/dataPasses/DataPassService.test.js b/test/lib/server/services/dataPasses/DataPassService.test.js index 42782c98eb..8fe70d9c63 100644 --- a/test/lib/server/services/dataPasses/DataPassService.test.js +++ b/test/lib/server/services/dataPasses/DataPassService.test.js @@ -26,7 +26,7 @@ const { Op } = require('sequelize'); const LHC22b_apass1 = { id: 1, name: 'LHC22b_apass1', - pdpBeamType: 'pp', + pdpBeamTypes: ['pp'], skimmingStage: SkimmingStage.SKIMMABLE, isFrozen: false, versions: [ diff --git a/test/lib/server/services/simulationPasses/SimulationPassesService.test.js b/test/lib/server/services/simulationPasses/SimulationPassesService.test.js index 0675bf8922..0cbe16d080 100644 --- a/test/lib/server/services/simulationPasses/SimulationPassesService.test.js +++ b/test/lib/server/services/simulationPasses/SimulationPassesService.test.js @@ -21,6 +21,7 @@ const LHC23k6c = { id: 1, name: 'LHC23k6c', jiraId: 'SIMTICKET-1', + pdpBeamTypes: ['pp'], description: 'Some Random general purpose for LHC23k6c', pwg: 'PWGX2', requestedEventsCount: 1345555, @@ -34,6 +35,7 @@ const LHC23k6b = { id: 2, name: 'LHC23k6b', jiraId: 'SIMTICKET-2', + pdpBeamTypes: ['pp'], description: 'Some Random general purpose for LHC23k6b', pwg: 'PWGX1', requestedEventsCount: 2345555, @@ -47,6 +49,7 @@ const LHC23k6a = { id: 3, name: 'LHC23k6a', jiraId: 'SIMTICKET-3', + pdpBeamTypes: ['pp'], description: 'Some Random general purpose for LHC23k6a', pwg: 'PWGX3', requestedEventsCount: 2245555, From a64932b5c34ff11ddb8afc0e16596ef2260c4fe2 Mon Sep 17 00:00:00 2001 From: xsalonx Date: Wed, 6 Aug 2025 16:55:36 +0200 Subject: [PATCH 05/22] fix --- lib/database/adapters/DataPassAdapter.js | 4 ++-- lib/database/adapters/LhcPeriodStatisticsAdapter.js | 2 +- lib/database/adapters/SimulationPassAdapter.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/database/adapters/DataPassAdapter.js b/lib/database/adapters/DataPassAdapter.js index bc08bb2e6f..066d89c81b 100644 --- a/lib/database/adapters/DataPassAdapter.js +++ b/lib/database/adapters/DataPassAdapter.js @@ -40,14 +40,14 @@ class DataPassAdapter { const runsCount = databaseObject.get('runsCount'); const simulationPassesCount = databaseObject.get('simulationPassesCount'); - const pdpBeamTypes = databaseObject.get('pdpBeamTypes'); + const pdpBeamTypes = databaseObject.get('pdpBeamTypes')?.split(',') || []; return { id, name, skimmingStage, versions: (versions ?? []).map(this.dataPassVersionAdapter.toEntity), - pdpBeamTypes: pdpBeamTypes?.split(',') ?? [], + pdpBeamTypes, runsCount, simulationPassesCount, isFrozen, diff --git a/lib/database/adapters/LhcPeriodStatisticsAdapter.js b/lib/database/adapters/LhcPeriodStatisticsAdapter.js index 275e79d417..858b82175d 100644 --- a/lib/database/adapters/LhcPeriodStatisticsAdapter.js +++ b/lib/database/adapters/LhcPeriodStatisticsAdapter.js @@ -43,7 +43,7 @@ class LhcPeriodStatisticsAdapter { avgCenterOfMassEnergy, runsCount, distinctEnergies, - pdpBeamTypes: pdpBeamTypes?.split(',') ?? [], + pdpBeamTypes, dataPassesCount, simulationPassesCount, lhcPeriod: lhcPeriod ? this.lhcPeriodAdapter.toEntity(lhcPeriod) : null, diff --git a/lib/database/adapters/SimulationPassAdapter.js b/lib/database/adapters/SimulationPassAdapter.js index 7f8b5aa955..f09fc185b4 100644 --- a/lib/database/adapters/SimulationPassAdapter.js +++ b/lib/database/adapters/SimulationPassAdapter.js @@ -42,7 +42,7 @@ class SimulationPassAdapter { const dataPassesCount = databaseObject.get('dataPassesCount'); const runsCount = databaseObject.get('runsCount'); - const pdpBeamTypes = databaseObject.get('pdpBeamTypes'); + const pdpBeamTypes = databaseObject.get('pdpBeamTypes')?.split(',') || []; return { id, @@ -55,7 +55,7 @@ class SimulationPassAdapter { outputSize, runsCount, dataPassesCount, - pdpBeamTypes: pdpBeamTypes?.split(',') ?? [], + pdpBeamTypes, }; } } From 6660370815018716a191bded5a9e7f6f60d035b6 Mon Sep 17 00:00:00 2001 From: xsalonx Date: Wed, 6 Aug 2025 16:59:59 +0200 Subject: [PATCH 06/22] fix --- lib/server/services/dataPasses/DataPassService.js | 2 +- test/api/simulationPasses.test.js | 2 +- .../services/simulationPasses/SimulationPassesService.test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/server/services/dataPasses/DataPassService.js b/lib/server/services/dataPasses/DataPassService.js index 0209815b32..5d4446aac6 100644 --- a/lib/server/services/dataPasses/DataPassService.js +++ b/lib/server/services/dataPasses/DataPassService.js @@ -190,7 +190,7 @@ class DataPassService { return dataSource.transaction(async () => { const dataPass = await this.getOneOrFail(identifier); - if (dataPass.pdpBeamType !== PdpBeamType.PROTON_PROTON) { + if (!dataPass.pdpBeamTypes.includes(PdpBeamType.PROTON_PROTON)) { throw new BadParameterError(`Cannot mark ${dataPass.name} as skimmable.` + ' Only production for PROTON_PROTON runs can be marked as skimmable'); } diff --git a/test/api/simulationPasses.test.js b/test/api/simulationPasses.test.js index b707b213ef..30179e0cb8 100644 --- a/test/api/simulationPasses.test.js +++ b/test/api/simulationPasses.test.js @@ -20,7 +20,7 @@ const LHC23k6c = { id: 1, name: 'LHC23k6c', jiraId: 'SIMTICKET-1', - pdpBeamTypes: ['pp'], + pdpBeamTypes: ['PbPB', 'pp'], description: 'Some Random general purpose for LHC23k6c', pwg: 'PWGX2', requestedEventsCount: 1345555, diff --git a/test/lib/server/services/simulationPasses/SimulationPassesService.test.js b/test/lib/server/services/simulationPasses/SimulationPassesService.test.js index 0cbe16d080..eb2516d1bb 100644 --- a/test/lib/server/services/simulationPasses/SimulationPassesService.test.js +++ b/test/lib/server/services/simulationPasses/SimulationPassesService.test.js @@ -21,7 +21,7 @@ const LHC23k6c = { id: 1, name: 'LHC23k6c', jiraId: 'SIMTICKET-1', - pdpBeamTypes: ['pp'], + pdpBeamTypes: ['PbPB', 'pp'], description: 'Some Random general purpose for LHC23k6c', pwg: 'PWGX2', requestedEventsCount: 1345555, From bcd5f73a57a1bdfe6834bade6364c1dfee09c511 Mon Sep 17 00:00:00 2001 From: xsalonx Date: Wed, 6 Aug 2025 17:03:09 +0200 Subject: [PATCH 07/22] fix --- test/api/simulationPasses.test.js | 2 +- .../services/simulationPasses/SimulationPassesService.test.js | 2 +- test/public/dataPasses/overviewPerLhcPeriod.test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/api/simulationPasses.test.js b/test/api/simulationPasses.test.js index 30179e0cb8..5cc67a9669 100644 --- a/test/api/simulationPasses.test.js +++ b/test/api/simulationPasses.test.js @@ -20,7 +20,7 @@ const LHC23k6c = { id: 1, name: 'LHC23k6c', jiraId: 'SIMTICKET-1', - pdpBeamTypes: ['PbPB', 'pp'], + pdpBeamTypes: ['PbPb', 'pp'], description: 'Some Random general purpose for LHC23k6c', pwg: 'PWGX2', requestedEventsCount: 1345555, diff --git a/test/lib/server/services/simulationPasses/SimulationPassesService.test.js b/test/lib/server/services/simulationPasses/SimulationPassesService.test.js index eb2516d1bb..f3d8d6c6d0 100644 --- a/test/lib/server/services/simulationPasses/SimulationPassesService.test.js +++ b/test/lib/server/services/simulationPasses/SimulationPassesService.test.js @@ -21,7 +21,7 @@ const LHC23k6c = { id: 1, name: 'LHC23k6c', jiraId: 'SIMTICKET-1', - pdpBeamTypes: ['PbPB', 'pp'], + pdpBeamTypes: ['PbPb', 'pp'], description: 'Some Random general purpose for LHC23k6c', pwg: 'PWGX2', requestedEventsCount: 1345555, diff --git a/test/public/dataPasses/overviewPerLhcPeriod.test.js b/test/public/dataPasses/overviewPerLhcPeriod.test.js index 410c48dc2f..4ab08e8de0 100644 --- a/test/public/dataPasses/overviewPerLhcPeriod.test.js +++ b/test/public/dataPasses/overviewPerLhcPeriod.test.js @@ -108,7 +108,7 @@ module.exports = () => { expectUrlParams(page, { page: 'runs-per-data-pass', dataPassId: '2', - pdpBeamType: 'pp', + pdpBeamTypes: 'pp', }); }); From da68eee9872f900579e5dabad4bbf1603a6d300e Mon Sep 17 00:00:00 2001 From: xsalonx Date: Wed, 6 Aug 2025 17:07:00 +0200 Subject: [PATCH 08/22] fix --- test/api/simulationPasses.test.js | 4 ++-- .../services/simulationPasses/SimulationPassesService.test.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/api/simulationPasses.test.js b/test/api/simulationPasses.test.js index 5cc67a9669..c4c154b212 100644 --- a/test/api/simulationPasses.test.js +++ b/test/api/simulationPasses.test.js @@ -34,7 +34,7 @@ const LHC23k6b = { id: 2, name: 'LHC23k6b', jiraId: 'SIMTICKET-2', - pdpBeamTypes: ['pp'], + pdpBeamTypes: ['PbPb'], description: 'Some Random general purpose for LHC23k6b', pwg: 'PWGX1', requestedEventsCount: 2345555, @@ -48,7 +48,7 @@ const LHC23k6a = { id: 3, name: 'LHC23k6a', jiraId: 'SIMTICKET-3', - pdpBeamTypes: ['pp'], + pdpBeamTypes: ['PbPb'], description: 'Some Random general purpose for LHC23k6a', pwg: 'PWGX3', requestedEventsCount: 2245555, diff --git a/test/lib/server/services/simulationPasses/SimulationPassesService.test.js b/test/lib/server/services/simulationPasses/SimulationPassesService.test.js index f3d8d6c6d0..01a1ed321b 100644 --- a/test/lib/server/services/simulationPasses/SimulationPassesService.test.js +++ b/test/lib/server/services/simulationPasses/SimulationPassesService.test.js @@ -35,7 +35,7 @@ const LHC23k6b = { id: 2, name: 'LHC23k6b', jiraId: 'SIMTICKET-2', - pdpBeamTypes: ['pp'], + pdpBeamTypes: ['PbPb'], description: 'Some Random general purpose for LHC23k6b', pwg: 'PWGX1', requestedEventsCount: 2345555, @@ -49,7 +49,7 @@ const LHC23k6a = { id: 3, name: 'LHC23k6a', jiraId: 'SIMTICKET-3', - pdpBeamTypes: ['pp'], + pdpBeamTypes: ['PbPb'], description: 'Some Random general purpose for LHC23k6a', pwg: 'PWGX3', requestedEventsCount: 2245555, From ae86763e0d6e9f82add8477249372931055174ab Mon Sep 17 00:00:00 2001 From: xsalonx Date: Wed, 6 Aug 2025 17:15:05 +0200 Subject: [PATCH 09/22] fix --- test/public/qcFlags/detailsForDataPass.test.js | 2 +- test/public/runs/dataPassesUtilities.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/public/qcFlags/detailsForDataPass.test.js b/test/public/qcFlags/detailsForDataPass.test.js index 15d72d9dc4..888a0c8567 100644 --- a/test/public/qcFlags/detailsForDataPass.test.js +++ b/test/public/qcFlags/detailsForDataPass.test.js @@ -66,7 +66,7 @@ module.exports = () => { it('can navigate to runs per data pass page', async () => { await waitForNavigation(page, () => pressElement(page, '#qc-flag-details-dataPass a', true)); - expectUrlParams(page, { page: 'runs-per-data-pass', dataPassId: '1', pdpBeamType: 'pp' }); + expectUrlParams(page, { page: 'runs-per-data-pass', dataPassId: '1', pdpBeamTypes: 'pp' }); await waitForNavigation(page, () => page.goBack()); }); diff --git a/test/public/runs/dataPassesUtilities.js b/test/public/runs/dataPassesUtilities.js index a1e0b53c3d..420940c95a 100644 --- a/test/public/runs/dataPassesUtilities.js +++ b/test/public/runs/dataPassesUtilities.js @@ -11,11 +11,11 @@ const { waitForNavigation, pressElement, getInnerText, expectUrlParams, waitForT */ exports.navigateToRunsPerDataPass = async (page, lhcPeriodId, dataPassId, expectedRowsCount) => { await waitForNavigation(page, () => pressElement(page, 'a#lhc-period-overview', true)); - const pdpBeamType = await getInnerText(await page.waitForSelector(`#row${lhcPeriodId}-pdpBeamTypes`)); + const pdpBeamTypes = await getInnerText(await page.waitForSelector(`#row${lhcPeriodId}-pdpBeamTypes`)); await waitForNavigation(page, () => pressElement(page, `#row${lhcPeriodId}-associatedDataPasses a`, true)); expectUrlParams(page, { page: 'data-passes-per-lhc-period-overview', lhcPeriodId }); await page.waitForSelector('th#description'); await waitForNavigation(page, () => pressElement(page, `#row${dataPassId}-associatedRuns a`, true)); - expectUrlParams(page, { page: 'runs-per-data-pass', dataPassId, pdpBeamType }); + expectUrlParams(page, { page: 'runs-per-data-pass', dataPassId, pdpBeamTypes }); await waitForTableLength(page, expectedRowsCount); }; From 8a808704d61775f24904d03c95a4f7e89533a774 Mon Sep 17 00:00:00 2001 From: xsalonx Date: Wed, 6 Aug 2025 17:24:55 +0200 Subject: [PATCH 10/22] fix --- .../views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js b/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js index e7ffe1b9fe..14e1b099dc 100644 --- a/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js +++ b/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js @@ -74,14 +74,14 @@ const mcReproducibleAsNotBadToggle = (value, onChange) => h('#mcReproducibleAsNo * @return {Component|null} badge or button */ const skimmableControl = (dataPass, onclick, requestResult) => { - const { name, pdpBeamType, skimmingStage } = dataPass; + const { name, pdpBeamTypes, skimmingStage } = dataPass; const skimmableIndicator = badge('Skimmable', { color: Color.SUCCESS }); if (skimmingStage === SkimmingStage.SKIMMABLE) { return skimmableIndicator; } const validSkimmableProductionNameRegex = /_apass\d+(?!.*(skimming|skimmed|debug|test))/; - if (validSkimmableProductionNameRegex.test(name) && pdpBeamType === PdpBeamType.PROTON_PROTON) { + if (validSkimmableProductionNameRegex.test(name) && pdpBeamTypes.include(PdpBeamType.PROTON_PROTON)) { const buttonContent = 'Mark as skimmable'; return requestResult.match({ Success: () => skimmableIndicator, From 912db9d4203ba883eca137447928d9ed7c119939 Mon Sep 17 00:00:00 2001 From: xsalonx Date: Wed, 6 Aug 2025 17:27:25 +0200 Subject: [PATCH 11/22] fix --- .../ActiveColumns/getInelasticInteractionRateActiveColumns.js | 1 - test/public/runs/runsPerLhcPeriod.overview.test.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/public/views/Runs/ActiveColumns/getInelasticInteractionRateActiveColumns.js b/lib/public/views/Runs/ActiveColumns/getInelasticInteractionRateActiveColumns.js index e3a9d70b2f..0f55ac0fb6 100644 --- a/lib/public/views/Runs/ActiveColumns/getInelasticInteractionRateActiveColumns.js +++ b/lib/public/views/Runs/ActiveColumns/getInelasticInteractionRateActiveColumns.js @@ -24,5 +24,4 @@ import { inelasticInteractionRateActiveColumnsForProtonProton as inelForPP } fro export const getInelasticInteractionRateColumns = (pdpBeamTypes) => ({ ...pdpBeamTypes?.includes(PdpBeamType.LEAD_LEAD) ? inelForPbPb : {}, ...pdpBeamTypes?.includes(PdpBeamType.PROTON_PROTON) ? inelForPP : {}, - ...pdpBeamTypes?.length === 0 ? { ...inelForPP, ...inelForPbPb } : {}, }); diff --git a/test/public/runs/runsPerLhcPeriod.overview.test.js b/test/public/runs/runsPerLhcPeriod.overview.test.js index 7e23ba1fcf..7629bf8310 100644 --- a/test/public/runs/runsPerLhcPeriod.overview.test.js +++ b/test/public/runs/runsPerLhcPeriod.overview.test.js @@ -73,7 +73,7 @@ module.exports = () => { }); it('loads the page successfully', async () => { - const response = await goToPage(page, 'runs-per-lhc-period', { queryParameters: { lhcPeriodName: 'LHC22a' } }); + const response = await goToPage(page, 'runs-per-lhc-period', { queryParameters: { lhcPeriodName: 'LHC22a', pdpBeamTypes: 'PbPb' } }); expect(response.status()).to.equal(200); From 4be1a2b855f7f9ea329334ef180041836ff56085 Mon Sep 17 00:00:00 2001 From: xsalonx Date: Thu, 7 Aug 2025 11:02:50 +0200 Subject: [PATCH 12/22] add ppBeamTypes to front links and fix set method --- .../components/qcFlags/qcFlagCreationPanelLink.js | 4 ++-- lib/public/views/QcFlags/QcFlagsModel.js | 8 ++++---- .../Runs/Overview/FixedPdpBeamTypeRunsOverviewModel.js | 10 ++++++---- lib/public/views/Runs/RunsModel.js | 6 +++--- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/public/components/qcFlags/qcFlagCreationPanelLink.js b/lib/public/components/qcFlags/qcFlagCreationPanelLink.js index b596bab89c..2ef75bcd64 100644 --- a/lib/public/components/qcFlags/qcFlagCreationPanelLink.js +++ b/lib/public/components/qcFlags/qcFlagCreationPanelLink.js @@ -51,10 +51,10 @@ export const qcFlagCreationPanelLink = ( return h('button.btn.btn-primary', { disabled: true, title: 'Datapass is frozen' }, content); } - options = { dataPassId: dataPass.id }; + options = { dataPassId: dataPass.id, pdpBeamTypes: dataPass.pdpBeamTypes }; pageName = 'qc-flag-creation-for-data-pass'; } else if (simulationPass) { - options = { simulationPassId: simulationPass.id }; + options = { simulationPassId: simulationPass.id, pdpBeamTypes: simulationPass.pdpBeamTypes }; pageName = 'qc-flag-creation-for-simulation-pass'; } else { return null; diff --git a/lib/public/views/QcFlags/QcFlagsModel.js b/lib/public/views/QcFlags/QcFlagsModel.js index 0d59bc4ec6..57411abf13 100644 --- a/lib/public/views/QcFlags/QcFlagsModel.js +++ b/lib/public/views/QcFlags/QcFlagsModel.js @@ -100,7 +100,7 @@ export class QcFlagsModel extends Observable { * @param {string} [params.runNumberDetectorsMap] - String representation of run number to detector map * @returns {void} */ - loadCreationForDataPass({ dataPassId, runNumberDetectorsMap }) { + loadCreationForDataPass({ dataPassId, runNumberDetectorsMap, pdpBeamTypes }) { const parsedRunNumberDetectorsMap = this._parseRunNumberDetectorMap(runNumberDetectorsMap ?? ''); this._creationForDataPassModel = new QcFlagCreationForDataPassModel( @@ -109,7 +109,7 @@ export class QcFlagsModel extends Observable { () => { this.model.router.go(buildUrl( '/', - { page: 'runs-per-data-pass', dataPassId }, + { page: 'runs-per-data-pass', dataPassId, pdpBeamTypes }, )); }, ); @@ -193,7 +193,7 @@ export class QcFlagsModel extends Observable { * @param {string} [parameters.runNumberDetectorsMap] - String representation of run number to detector map * @returns {void} */ - loadCreationForSimulationPass({ simulationPassId, runNumberDetectorsMap }) { + loadCreationForSimulationPass({ simulationPassId, runNumberDetectorsMap, pdpBeamTypes }) { const parsedRunNumberDetectorMap = this._parseRunNumberDetectorMap(runNumberDetectorsMap ?? ''); this._creationForSimulationPassModel = new QcFlagCreationForSimulationPassModel( @@ -202,7 +202,7 @@ export class QcFlagsModel extends Observable { () => { this.model.router.go(buildUrl( '/', - { page: 'runs-per-simulation-pass', simulationPassId }, + { page: 'runs-per-simulation-pass', simulationPassId, pdpBeamTypes }, )); }, ); diff --git a/lib/public/views/Runs/Overview/FixedPdpBeamTypeRunsOverviewModel.js b/lib/public/views/Runs/Overview/FixedPdpBeamTypeRunsOverviewModel.js index 9184cd3c24..82eaf9e819 100644 --- a/lib/public/views/Runs/Overview/FixedPdpBeamTypeRunsOverviewModel.js +++ b/lib/public/views/Runs/Overview/FixedPdpBeamTypeRunsOverviewModel.js @@ -26,7 +26,7 @@ export class FixedPdpBeamTypeRunsOverviewModel extends RunsWithQcModel { */ constructor(model) { super(model); - this._pdpBeamTypes = null; + this._pdpBeamTypes = []; } /** @@ -41,9 +41,11 @@ export class FixedPdpBeamTypeRunsOverviewModel extends RunsWithQcModel { /** * Set pdp_beam_type of fetched runs * - * @param {string|string[]} pdpBeamTypes beam type + * @param {string|string[]|null} pdpBeamTypes beam type, nullish values are ignored */ - set pdpBeamTypes(pdpBeamTypes) { - this._pdpBeamTypes = typeof pdpBeamTypes === 'string' ? pdpBeamTypes.split(',') : pdpBeamTypes; + setPdpBeamTypes(pdpBeamTypes) { + if (pdpBeamTypes) { + this._pdpBeamTypes = typeof pdpBeamTypes === 'string' ? pdpBeamTypes.split(',') : pdpBeamTypes; + } } } diff --git a/lib/public/views/Runs/RunsModel.js b/lib/public/views/Runs/RunsModel.js index ff4afb8451..17470a1802 100644 --- a/lib/public/views/Runs/RunsModel.js +++ b/lib/public/views/Runs/RunsModel.js @@ -94,7 +94,7 @@ export class RunsModel extends Observable { this._perLhcPeriodOverviewModel.tabbedPanelModel.currentPanelKey = panel; if (!this._perLhcPeriodOverviewModel.pagination.isInfiniteScrollEnabled) { this._perLhcPeriodOverviewModel.lhcPeriodName = lhcPeriodName; - this._perLhcPeriodOverviewModel.pdpBeamTypes = pdpBeamTypes; + this._perLhcPeriodOverviewModel.setPdpBeamTypes(pdpBeamTypes); this._perLhcPeriodOverviewModel.load(); } } @@ -117,7 +117,7 @@ export class RunsModel extends Observable { loadPerDataPassOverview({ dataPassId, pdpBeamTypes }) { if (!this._perDataPassOverviewModel.pagination.isInfiniteScrollEnabled) { this._perDataPassOverviewModel.dataPassId = parseInt(dataPassId, 10); - this._perDataPassOverviewModel.pdpBeamTypes = pdpBeamTypes; + this._perDataPassOverviewModel.setPdpBeamTypes(pdpBeamTypes); this._perDataPassOverviewModel.load(); } } @@ -140,7 +140,7 @@ export class RunsModel extends Observable { loadPerSimulationPassOverview({ simulationPassId, pdpBeamTypes }) { if (!this._perSimulationPassOverviewModel.pagination.isInfiniteScrollEnabled) { this._perSimulationPassOverviewModel.simulationPassId = parseInt(simulationPassId, 10); - this._perSimulationPassOverviewModel.pdpBeamTypes = pdpBeamTypes; + this._perSimulationPassOverviewModel.setPdpBeamTypes(pdpBeamTypes); this._perSimulationPassOverviewModel.load(); } } From c5f8319706ffebb217301232e8d47ee82abf48b7 Mon Sep 17 00:00:00 2001 From: xsalonx Date: Thu, 7 Aug 2025 12:37:37 +0200 Subject: [PATCH 13/22] fix --- .../views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js b/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js index 14e1b099dc..6ddcb0a7bf 100644 --- a/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js +++ b/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js @@ -81,7 +81,7 @@ const skimmableControl = (dataPass, onclick, requestResult) => { } const validSkimmableProductionNameRegex = /_apass\d+(?!.*(skimming|skimmed|debug|test))/; - if (validSkimmableProductionNameRegex.test(name) && pdpBeamTypes.include(PdpBeamType.PROTON_PROTON)) { + if (validSkimmableProductionNameRegex.test(name) && pdpBeamTypes.includes(PdpBeamType.PROTON_PROTON)) { const buttonContent = 'Mark as skimmable'; return requestResult.match({ Success: () => skimmableIndicator, From 3f092d858bc9060b4eba8c11b2896bd4283bf2df Mon Sep 17 00:00:00 2001 From: xsalonx Date: Thu, 7 Aug 2025 12:51:16 +0200 Subject: [PATCH 14/22] rm unncessary param --- .../ActiveColumns/dataPassesActiveColumns.js | 4 ++-- lib/public/views/QcFlags/QcFlagsModel.js | 10 ++++++---- .../RunPerDataPass/RunsPerDataPassOverviewModel.js | 7 ++++++- lib/public/views/Runs/RunsModel.js | 13 ++++--------- .../RunsPerSimulationPassOverviewModel.js | 7 ++++++- .../ActiveColumns/simulationPassesActiveColumns.js | 4 ++-- .../ActiveColumns/lhcPeriodsActiveColumns.js | 4 ++-- test/public/runs/runsPerDataPass.overview.test.js | 2 +- .../runs/runsPerSimulationPass.overview.test.js | 2 +- 9 files changed, 30 insertions(+), 23 deletions(-) diff --git a/lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js b/lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js index 191456db30..45d55bf6c6 100644 --- a/lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js +++ b/lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js @@ -46,13 +46,13 @@ export const dataPassesActiveColumns = { associatedRuns: { name: 'Runs', visible: true, - format: (_, { id, runsCount, pdpBeamTypes }) => + format: (_, { id, runsCount }) => runsCount === 0 ? 'No runs' : frontLink( badge(runsCount), 'runs-per-data-pass', - { dataPassId: id, pdpBeamTypes }, + { dataPassId: id }, ), classes: 'w-10', }, diff --git a/lib/public/views/QcFlags/QcFlagsModel.js b/lib/public/views/QcFlags/QcFlagsModel.js index 57411abf13..985e742d2f 100644 --- a/lib/public/views/QcFlags/QcFlagsModel.js +++ b/lib/public/views/QcFlags/QcFlagsModel.js @@ -95,9 +95,10 @@ export class QcFlagsModel extends Observable { /** * Load the creation for data pass page model * - * @param {Object} params - Parameters for the method - * @param {number} params.dataPassId - The data pass ID - * @param {string} [params.runNumberDetectorsMap] - String representation of run number to detector map + * @param {Object} parameters - Parameters for the method + * @param {number} parameters.dataPassId - The data pass ID + * @param {string} parameters.runNumberDetectorsMap - String representation of run number to detector map + * @param {string} parameters.pdpBeamTypes the beam types of the runs to display * @returns {void} */ loadCreationForDataPass({ dataPassId, runNumberDetectorsMap, pdpBeamTypes }) { @@ -190,7 +191,8 @@ export class QcFlagsModel extends Observable { * Load the creation for simulation pass page model * @param {object} parameters parameters for the model * @param {number} parameters.simulationPassId - The simulation pass ID - * @param {string} [parameters.runNumberDetectorsMap] - String representation of run number to detector map + * @param {string} parameters.runNumberDetectorsMap - String representation of run number to detector map + * @param {string} parameters.pdpBeamTypes the beam types of the runs to display * @returns {void} */ loadCreationForSimulationPass({ simulationPassId, runNumberDetectorsMap, pdpBeamTypes }) { diff --git a/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewModel.js b/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewModel.js index fdc2ee2f31..de3f61ae77 100644 --- a/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewModel.js +++ b/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewModel.js @@ -122,7 +122,12 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo this._fetchGaqSummary(); await this._fetchDataPass(); this._dataPass.getCurrent().match({ - Success: ({ skimmingStage }) => skimmingStage === SkimmingStage.SKIMMABLE && this._fetchSkimmableRuns(), + Success: ({ skimmingStage, pdpBeamTypes }) => { + if (skimmingStage === SkimmingStage.SKIMMABLE) { + this._fetchSkimmableRuns(); + } + this.setPdpBeamTypes(pdpBeamTypes); + }, Other: () => null, }); super.load(); diff --git a/lib/public/views/Runs/RunsModel.js b/lib/public/views/Runs/RunsModel.js index 17470a1802..570d7d676c 100644 --- a/lib/public/views/Runs/RunsModel.js +++ b/lib/public/views/Runs/RunsModel.js @@ -87,14 +87,13 @@ export class RunsModel extends Observable { * @param {object} params the parameters for the model * @param {string} params.lhcPeriodName the name of the LHC period to display * @param {string} params.panel the key of the panel to display - * @param {string} params.pdpBeamTypes the key of the panel to display + * @param {string} params.pdpBeamTypesx the key of the panel to display * @return {void} */ - loadPerLhcPeriodOverview({ lhcPeriodName, panel, pdpBeamTypes }) { + loadPerLhcPeriodOverview({ lhcPeriodName, panel }) { this._perLhcPeriodOverviewModel.tabbedPanelModel.currentPanelKey = panel; if (!this._perLhcPeriodOverviewModel.pagination.isInfiniteScrollEnabled) { this._perLhcPeriodOverviewModel.lhcPeriodName = lhcPeriodName; - this._perLhcPeriodOverviewModel.setPdpBeamTypes(pdpBeamTypes); this._perLhcPeriodOverviewModel.load(); } } @@ -111,13 +110,11 @@ export class RunsModel extends Observable { * Load runs overview data * @param {object} params the parameters for the model * @param {string} params.dataPassId the id of the data pass to display - * @param {string} params.pdpBeamTypes the beam types of the runs to display * @return {void} */ - loadPerDataPassOverview({ dataPassId, pdpBeamTypes }) { + loadPerDataPassOverview({ dataPassId }) { if (!this._perDataPassOverviewModel.pagination.isInfiniteScrollEnabled) { this._perDataPassOverviewModel.dataPassId = parseInt(dataPassId, 10); - this._perDataPassOverviewModel.setPdpBeamTypes(pdpBeamTypes); this._perDataPassOverviewModel.load(); } } @@ -134,13 +131,11 @@ export class RunsModel extends Observable { * Load runs overview per simulation pass data * @param {object} params - The parameters for the model. * @param {string} params.simulationPassId - The ID of the simulation pass to load. - * @param {string} params.pdpBeamTypes the beam types of the runs to display * @return {void} */ - loadPerSimulationPassOverview({ simulationPassId, pdpBeamTypes }) { + loadPerSimulationPassOverview({ simulationPassId }) { if (!this._perSimulationPassOverviewModel.pagination.isInfiniteScrollEnabled) { this._perSimulationPassOverviewModel.simulationPassId = parseInt(simulationPassId, 10); - this._perSimulationPassOverviewModel.setPdpBeamTypes(pdpBeamTypes); this._perSimulationPassOverviewModel.load(); } } diff --git a/lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewModel.js b/lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewModel.js index dcd64943c7..f948724e42 100644 --- a/lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewModel.js +++ b/lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewModel.js @@ -73,7 +73,12 @@ export class RunsPerSimulationPassOverviewModel extends FixedPdpBeamTypeRunsOver this._runDetectorsSelectionModel.reset(); this._fetchQcSummary(); - this._fetchSimulationPass(); + this._fetchSimulationPass().then(() => { + this._simulationPass$.getCurrent().match({ + Success: ({ pdpBeamTypes }) => this.setPdpBeamTypes(pdpBeamTypes), + Other: () => null, + }); + }); super.load(); } diff --git a/lib/public/views/SimulationPasses/ActiveColumns/simulationPassesActiveColumns.js b/lib/public/views/SimulationPasses/ActiveColumns/simulationPassesActiveColumns.js index 59b181f02e..32fcee388a 100644 --- a/lib/public/views/SimulationPasses/ActiveColumns/simulationPassesActiveColumns.js +++ b/lib/public/views/SimulationPasses/ActiveColumns/simulationPassesActiveColumns.js @@ -37,13 +37,13 @@ export const simulationPassesActiveColumns = { associatedRuns: { name: 'Runs', visible: true, - format: (_, { id, runsCount, pdpBeamTypes }) => + format: (_, { id, runsCount }) => runsCount === 0 ? 'No runs' : frontLink( badge(runsCount), 'runs-per-simulation-pass', - { simulationPassId: id, pdpBeamTypes }, + { simulationPassId: id }, ), classes: 'w-10 f6', }, diff --git a/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js b/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js index 473ac5578d..aa1d84c3a7 100644 --- a/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js +++ b/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js @@ -40,13 +40,13 @@ export const lhcPeriodsActiveColumns = { associatedRuns: { name: 'Runs', visible: true, - format: (_, { name, runsCount, pdpBeamTypes }) => + format: (_, { name, runsCount }) => runsCount === 0 ? 'No runs' : frontLink( badge(runsCount), 'runs-per-lhc-period', - { lhcPeriodName: name, pdpBeamTypes }, + { lhcPeriodName: name }, ), classes: 'w-10', }, diff --git a/test/public/runs/runsPerDataPass.overview.test.js b/test/public/runs/runsPerDataPass.overview.test.js index 1656ee6a20..3ebb98f11b 100644 --- a/test/public/runs/runsPerDataPass.overview.test.js +++ b/test/public/runs/runsPerDataPass.overview.test.js @@ -134,7 +134,7 @@ module.exports = () => { await validateTableData(page, new Map(Object.entries(tableDataValidators))); await expectLink(page, 'tr#row106 .column-EMC a', { - href: 'http://localhost:4000/?page=qc-flag-creation-for-data-pass&runNumberDetectorsMap=106:2&dataPassId=1', + href: 'http://localhost:4000/?page=qc-flag-creation-for-data-pass&runNumberDetectorsMap=106:2&dataPassId=1pdpBeamTypes=pp', innerText: 'QC', }); diff --git a/test/public/runs/runsPerSimulationPass.overview.test.js b/test/public/runs/runsPerSimulationPass.overview.test.js index adb30973f3..ee0502bd8f 100644 --- a/test/public/runs/runsPerSimulationPass.overview.test.js +++ b/test/public/runs/runsPerSimulationPass.overview.test.js @@ -73,7 +73,7 @@ module.exports = () => { }); it('loads the page successfully', async () => { - const response = await goToPage(page, 'runs-per-simulation-pass', { queryParameters: { simulationPassId: 2 } }); + const response = await goToPage(page, 'runs-per-simulation-pass', { queryParameters: { simulationPassId: 2, pdp } }); // We expect the page to return the correct status code, making sure the server is running properly expect(response.status()).to.equal(200); From 3b503a1eb2f620a4c14488b7186dd1b7d677931b Mon Sep 17 00:00:00 2001 From: xsalonx Date: Thu, 7 Aug 2025 15:41:47 +0200 Subject: [PATCH 15/22] rm pdpBeamType --- lib/public/components/qcFlags/qcFlagCreationPanelLink.js | 4 ++-- test/public/runs/runsPerDataPass.overview.test.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/public/components/qcFlags/qcFlagCreationPanelLink.js b/lib/public/components/qcFlags/qcFlagCreationPanelLink.js index 2ef75bcd64..b596bab89c 100644 --- a/lib/public/components/qcFlags/qcFlagCreationPanelLink.js +++ b/lib/public/components/qcFlags/qcFlagCreationPanelLink.js @@ -51,10 +51,10 @@ export const qcFlagCreationPanelLink = ( return h('button.btn.btn-primary', { disabled: true, title: 'Datapass is frozen' }, content); } - options = { dataPassId: dataPass.id, pdpBeamTypes: dataPass.pdpBeamTypes }; + options = { dataPassId: dataPass.id }; pageName = 'qc-flag-creation-for-data-pass'; } else if (simulationPass) { - options = { simulationPassId: simulationPass.id, pdpBeamTypes: simulationPass.pdpBeamTypes }; + options = { simulationPassId: simulationPass.id }; pageName = 'qc-flag-creation-for-simulation-pass'; } else { return null; diff --git a/test/public/runs/runsPerDataPass.overview.test.js b/test/public/runs/runsPerDataPass.overview.test.js index 3ebb98f11b..1656ee6a20 100644 --- a/test/public/runs/runsPerDataPass.overview.test.js +++ b/test/public/runs/runsPerDataPass.overview.test.js @@ -134,7 +134,7 @@ module.exports = () => { await validateTableData(page, new Map(Object.entries(tableDataValidators))); await expectLink(page, 'tr#row106 .column-EMC a', { - href: 'http://localhost:4000/?page=qc-flag-creation-for-data-pass&runNumberDetectorsMap=106:2&dataPassId=1pdpBeamTypes=pp', + href: 'http://localhost:4000/?page=qc-flag-creation-for-data-pass&runNumberDetectorsMap=106:2&dataPassId=1', innerText: 'QC', }); From 79b192798662ea1f3985dc84af6441713d91b48d Mon Sep 17 00:00:00 2001 From: xsalonx Date: Thu, 7 Aug 2025 15:49:46 +0200 Subject: [PATCH 16/22] use lhc period Id --- .../RunsPerDataPassOverviewModel.js | 32 ++++---- .../RunsPerLhcPeriodOverviewModel.js | 78 ++++++++++++++----- lib/public/views/Runs/RunsModel.js | 7 +- .../ActiveColumns/lhcPeriodsActiveColumns.js | 4 +- 4 files changed, 78 insertions(+), 43 deletions(-) diff --git a/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewModel.js b/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewModel.js index de3f61ae77..c6b18dd6ad 100644 --- a/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewModel.js +++ b/lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewModel.js @@ -43,8 +43,8 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo })); }), })); - this._dataPass = new ObservableData(RemoteData.notAsked()); - this._dataPass.bubbleTo(this); + this._dataPass$ = new ObservableData(RemoteData.notAsked()); + this._dataPass$.bubbleTo(this); this._qcSummary$ = new ObservableData(RemoteData.notAsked()); this._qcSummary$.bubbleTo(this); this._gaqSummary$ = new ObservableData(RemoteData.notAsked()); @@ -120,16 +120,16 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo this._fetchQcSummary(); this._fetchGaqSummary(); - await this._fetchDataPass(); - this._dataPass.getCurrent().match({ - Success: ({ skimmingStage, pdpBeamTypes }) => { - if (skimmingStage === SkimmingStage.SKIMMABLE) { - this._fetchSkimmableRuns(); - } - this.setPdpBeamTypes(pdpBeamTypes); - }, - Other: () => null, - }); + await this._fetchDataPass().then(() => + this._dataPass$.getCurrent().match({ + Success: ({ skimmingStage, pdpBeamTypes }) => { + if (skimmingStage === SkimmingStage.SKIMMABLE) { + this._fetchSkimmableRuns(); + } + this.setPdpBeamTypes(pdpBeamTypes); + }, + Other: () => null, + })); super.load(); } @@ -284,7 +284,7 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo * Get current data pass which runs are fetched */ get dataPass() { - return this._dataPass.getCurrent(); + return this._dataPass$.getCurrent(); } /** @@ -353,12 +353,12 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo * @return {Promise} promise */ async _fetchDataPass() { - this._dataPass.setCurrent(RemoteData.loading()); + this._dataPass$.setCurrent(RemoteData.loading()); try { const { items: [dataPass] = [] } = await getRemoteDataSlice(`/api/dataPasses?filter[ids][]=${this._dataPassId}`); - this._dataPass.setCurrent(RemoteData.success(dataPass)); + this._dataPass$.setCurrent(RemoteData.success(dataPass)); } catch (error) { - this._dataPass.setCurrent(RemoteData.failure(error)); + this._dataPass$.setCurrent(RemoteData.failure(error)); } } diff --git a/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewModel.js b/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewModel.js index e8c83d1f2b..05cfc7e523 100644 --- a/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewModel.js +++ b/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewModel.js @@ -14,6 +14,7 @@ import { buildUrl, RemoteData } from '/js/src/index.js'; import { TabbedPanelModel } from '../../../components/TabbedPanel/TabbedPanelModel.js'; import { detectorsProvider } from '../../../services/detectors/detectorsProvider.js'; import { jsonFetch } from '../../../utilities/fetch/jsonFetch.js'; +import { ObservableData } from '../../../utilities/ObservableData.js'; import { FixedPdpBeamTypeRunsOverviewModel } from '../Overview/FixedPdpBeamTypeRunsOverviewModel.js'; export const RUNS_PER_LHC_PERIOD_PANELS_KEYS = { @@ -35,17 +36,52 @@ export class RunsPerLhcPeriodOverviewModel extends FixedPdpBeamTypeRunsOverviewM this._detectors$ = detectorsProvider.physical$; this._detectors$.bubbleTo(this); + this._lhcPeriodId = null; + this._lhcPeriod$ = new ObservableData(RemoteData.notAsked()); + this._lhcPeriod$.bubbleTo(this); + this._tabbedPanelModel = new RunsPerLhcPeriodTabbedPanelModel(); this._tabbedPanelModel.bubbleTo(this); } + /** + * Fetch LHC period data which runs are fetched + * @return {Promise} promise + */ + async _fetchLhcPeriod() { + this._lhcPeriod$.setCurrent(RemoteData.loading()); + try { + const { data: [lhcPeriod] } = await jsonFetch(`/api/lhcPeriodsStatistics?filter[ids][]=${this._lhcPeriodId}`); + this._lhcPeriod$.setCurrent(RemoteData.success(lhcPeriod)); + } catch (error) { + this._lhcPeriod$.setCurrent(RemoteData.failure(error)); + } + } + + /** + * @inheritdoc + */ + async load() { + if (!this._lhcPeriodId) { + return; + } + + this._fetchLhcPeriod().then(() => + this._lhcPeriod$.getCurrent().match({ + Success: ({ pdpBeamTypes }) => this.setPdpBeamTypes(pdpBeamTypes), + Other: () => null, + })); + + super.load(); + } + /** * @inheritdoc */ getRootEndpoint() { return buildUrl(super.getRootEndpoint(), { filter: { - lhcPeriods: this._lhcPeriodName, + lhcPeriodIds: [this._lhcPeriodId], runQualities: 'good', definitions: 'PHYSICS', }, @@ -53,20 +89,20 @@ export class RunsPerLhcPeriodOverviewModel extends FixedPdpBeamTypeRunsOverviewM } /** - * Get name of current lhc period which runs are fetched + * Get LHC period which runs are fetched */ - get lhcPeriodName() { - return this._lhcPeriodName; + get lhcPeriod() { + return this._lhcPeriod$.getCurrent(); } /** - * Set name of current lhc period which runs are fetched + * Set id of current LHC period which runs are fetched * - * @param {string} lhcPeriodName name of LHC period + * @param {string} lhcPeriodId id of a LHC period */ - set lhcPeriodName(lhcPeriodName) { - this._lhcPeriodName = lhcPeriodName; - this._tabbedPanelModel.lhcPeriodName = lhcPeriodName; + set lhcPeriodId(lhcPeriodId) { + this._lhcPeriodId = lhcPeriodId; + this._tabbedPanelModel.lhcPeriodId = lhcPeriodId; } /** @@ -119,17 +155,17 @@ class RunsPerLhcPeriodTabbedPanelModel extends TabbedPanelModel { * @return {Promise} resolved once data are fetched */ async _fetchSynchronousQcSummary() { - if (this._lhcPeriodName) { + if (this._lhcPeriodId) { this.currentPanelData = RemoteData.loading(); this.notify(); try { - const { data: [lhcPeriod] } = await jsonFetch(`/api/lhcPeriodsStatistics?filter[names][]=${this._lhcPeriodName}`); - if (!lhcPeriod) { - this.currentPanelData = RemoteData.failure([{ title: `Cannot find LHC period with name '${this._lhcPeriodName}'` }]); - } else { - const { data: qcSummary } = await jsonFetch(`/api/qcFlags/summary?lhcPeriodId=${lhcPeriod.id}`); - this.currentPanelData = RemoteData.success(qcSummary); - } + const { data: qcSummary } = await jsonFetch(buildUrl( + '/api/qcFlags/summary', + { + lhcPeriodId: this._lhcPeriodId, + }, + )); + this.currentPanelData = RemoteData.success(qcSummary); } catch (errors) { this.currentPanelData = RemoteData.failure(errors); } @@ -138,12 +174,12 @@ class RunsPerLhcPeriodTabbedPanelModel extends TabbedPanelModel { } /** - * Set LHC period name + * Set LHC period id * - * @param {string} lhcPeriodName name of LHC period + * @param {id} lhcPeriodId id of LHC period */ - set lhcPeriodName(lhcPeriodName) { - this._lhcPeriodName = lhcPeriodName; + set lhcPeriodId(lhcPeriodId) { + this._lhcPeriodId = lhcPeriodId; this._fetchCurrentPanelData(); } } diff --git a/lib/public/views/Runs/RunsModel.js b/lib/public/views/Runs/RunsModel.js index 570d7d676c..5952f83e3a 100644 --- a/lib/public/views/Runs/RunsModel.js +++ b/lib/public/views/Runs/RunsModel.js @@ -85,15 +85,14 @@ export class RunsModel extends Observable { /** * Load runs overview data * @param {object} params the parameters for the model - * @param {string} params.lhcPeriodName the name of the LHC period to display + * @param {string} params.lhcPeriodId the name of the LHC period to display * @param {string} params.panel the key of the panel to display - * @param {string} params.pdpBeamTypesx the key of the panel to display * @return {void} */ - loadPerLhcPeriodOverview({ lhcPeriodName, panel }) { + loadPerLhcPeriodOverview({ lhcPeriodId, panel }) { this._perLhcPeriodOverviewModel.tabbedPanelModel.currentPanelKey = panel; if (!this._perLhcPeriodOverviewModel.pagination.isInfiniteScrollEnabled) { - this._perLhcPeriodOverviewModel.lhcPeriodName = lhcPeriodName; + this._perLhcPeriodOverviewModel.lhcPeriodId = lhcPeriodId; this._perLhcPeriodOverviewModel.load(); } } diff --git a/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js b/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js index aa1d84c3a7..e88c97053a 100644 --- a/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js +++ b/lib/public/views/lhcPeriods/ActiveColumns/lhcPeriodsActiveColumns.js @@ -40,13 +40,13 @@ export const lhcPeriodsActiveColumns = { associatedRuns: { name: 'Runs', visible: true, - format: (_, { name, runsCount }) => + format: (_, { id, runsCount }) => runsCount === 0 ? 'No runs' : frontLink( badge(runsCount), 'runs-per-lhc-period', - { lhcPeriodName: name }, + { lhcPeriodId: id }, ), classes: 'w-10', }, From b81ca626d6b0ed8bdf76427c9e191726e0dfe85d Mon Sep 17 00:00:00 2001 From: xsalonx Date: Thu, 7 Aug 2025 15:56:23 +0200 Subject: [PATCH 17/22] mv from another b --- .../RunsPerLhcPeriodOverviewPage.js | 76 ++++++++++--------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewPage.js b/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewPage.js index d920c86d2c..3424f8c10f 100644 --- a/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewPage.js +++ b/lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewPage.js @@ -22,6 +22,9 @@ import { isRunNotSubjectToQc } from '../../../components/qcFlags/isRunNotSubject import { runDetectorsSyncQcActiveColumns } from '../ActiveColumns/runDetectorsSyncQcActiveColumns.js'; import { tabbedPanelComponent } from '../../../components/TabbedPanel/tabbedPanelComponent.js'; import { RUNS_PER_LHC_PERIOD_PANELS_KEYS } from './RunsPerLhcPeriodOverviewModel.js'; +import { mergeRemoteData } from '../../../utilities/mergeRemoteData.js'; +import errorAlert from '../../../components/common/errorAlert.js'; +import spinner from '../../../components/common/spinner.js'; import { getInelasticInteractionRateColumns } from '../ActiveColumns/getInelasticInteractionRateActiveColumns.js'; const TABLEROW_HEIGHT = 62; @@ -52,7 +55,7 @@ export const RunsPerLhcPeriodOverviewPage = ({ runs: { perLhcPeriodOverviewModel const { items: remoteRuns, detectors: remoteDetectors, - lhcPeriodName, + lhcPeriod: remoteLhcPeriod, displayOptions, sortModel, tabbedPanelModel, @@ -67,7 +70,7 @@ export const RunsPerLhcPeriodOverviewPage = ({ runs: { perLhcPeriodOverviewModel /** * Render runs table with given detectors' active columns configuration * - * @param {object} detectorsActiveColumns active columns + * @param {object} detectorsActiveColumns detectors specific columns * @return {Component} table with pagination */ const getTableWithGivenDetectorsColumns = (detectorsActiveColumns) => @@ -75,9 +78,8 @@ export const RunsPerLhcPeriodOverviewPage = ({ runs: { perLhcPeriodOverviewModel /* * Columns depends on detectors' list, it's not useful to render the table when detectors are missing - * TODO replace by RemoteData merging */ - remoteDetectors.match({ Success: () => remoteRuns, Other: () => remoteDetectors }), + remoteRuns, { ...activeColumns, ...detectorsActiveColumns, @@ -91,37 +93,39 @@ export const RunsPerLhcPeriodOverviewPage = ({ runs: { perLhcPeriodOverviewModel { sort: sortModel }, ); - return h('.intermediate-flex-column', [ - h('.flex-row.justify-between.g2', [ - h('h2', `Good, physics runs of ${lhcPeriodName}`), - exportRunsTriggerAndModal(perLhcPeriodOverviewModel, modalModel), - ]), - ...tabbedPanelComponent( - tabbedPanelModel, - { - [RUNS_PER_LHC_PERIOD_PANELS_KEYS.DETECTOR_QUALITIES]: 'Qualities of detectors', - [RUNS_PER_LHC_PERIOD_PANELS_KEYS.SYNCHRONOUS_FLAGS]: 'Synchronous QC flags', - }, - { - [RUNS_PER_LHC_PERIOD_PANELS_KEYS.DETECTOR_QUALITIES]: - () => getTableWithGivenDetectorsColumns(runDetectorsQualitiesActiveColumns( - remoteDetectors.match({ Success: (payload) => payload, Other: () => [] }), - { profiles: 'runsPerLhcPeriod' }, - )), + return h( + '.intermediate-flex-column', + { onremove: () => perLhcPeriodOverviewModel.reset(false) }, + mergeRemoteData([remoteLhcPeriod, remoteRuns, remoteDetectors]).match({ + NotAsked: () => null, + Failure: (errors) => errorAlert(errors), + Loading: () => spinner(), + Success: ([lhcPeriod, _, detectors]) => [ + h('.flex-row.justify-between.items-center.g2', [ + h('h2', `Good, physics runs of ${lhcPeriod.lhcPeriod.name}`), + exportRunsTriggerAndModal(perLhcPeriodOverviewModel, modalModel), + ]), + ...tabbedPanelComponent( + tabbedPanelModel, + { + [RUNS_PER_LHC_PERIOD_PANELS_KEYS.DETECTOR_QUALITIES]: 'Qualities of detectors', + [RUNS_PER_LHC_PERIOD_PANELS_KEYS.SYNCHRONOUS_FLAGS]: 'Synchronous QC flags', + }, + { + [RUNS_PER_LHC_PERIOD_PANELS_KEYS.DETECTOR_QUALITIES]: + () => getTableWithGivenDetectorsColumns(runDetectorsQualitiesActiveColumns(detectors, { profiles: 'runsPerLhcPeriod' })), - [RUNS_PER_LHC_PERIOD_PANELS_KEYS.SYNCHRONOUS_FLAGS]: - (remoteSynchronousQcSummary) => getTableWithGivenDetectorsColumns(runDetectorsSyncQcActiveColumns( - remoteDetectors.match({ Success: (payload) => payload, Other: () => [] }), - { - profiles: 'runsPerLhcPeriod', - qcSummary: remoteSynchronousQcSummary.match({ Success: (qcSummary) => qcSummary, Other: () => null }), - }, - )), - }, - { - panelClass: ['scroll-auto'], - }, - ), - paginationComponent(perLhcPeriodOverviewModel.pagination), - ]); + [RUNS_PER_LHC_PERIOD_PANELS_KEYS.SYNCHRONOUS_FLAGS]: (remoteSynchronousQcSummary) => + getTableWithGivenDetectorsColumns(runDetectorsSyncQcActiveColumns(detectors, { + profiles: 'runsPerLhcPeriod', + qcSummary: remoteSynchronousQcSummary?.match({ Success: (qcSummary) => qcSummary, Other: () => null }), + })), + }, + { panelClass: ['scroll-auto'] }, + ), + paginationComponent(perLhcPeriodOverviewModel.pagination), + ], + }), + + ); }; From 893aa865e9cb88fd5318dd0906c36f487d679899 Mon Sep 17 00:00:00 2001 From: xsalonx Date: Thu, 7 Aug 2025 15:57:36 +0200 Subject: [PATCH 18/22] cleanup --- lib/public/views/QcFlags/QcFlagsModel.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/public/views/QcFlags/QcFlagsModel.js b/lib/public/views/QcFlags/QcFlagsModel.js index 985e742d2f..9cb026aa8a 100644 --- a/lib/public/views/QcFlags/QcFlagsModel.js +++ b/lib/public/views/QcFlags/QcFlagsModel.js @@ -98,10 +98,9 @@ export class QcFlagsModel extends Observable { * @param {Object} parameters - Parameters for the method * @param {number} parameters.dataPassId - The data pass ID * @param {string} parameters.runNumberDetectorsMap - String representation of run number to detector map - * @param {string} parameters.pdpBeamTypes the beam types of the runs to display * @returns {void} */ - loadCreationForDataPass({ dataPassId, runNumberDetectorsMap, pdpBeamTypes }) { + loadCreationForDataPass({ dataPassId, runNumberDetectorsMap }) { const parsedRunNumberDetectorsMap = this._parseRunNumberDetectorMap(runNumberDetectorsMap ?? ''); this._creationForDataPassModel = new QcFlagCreationForDataPassModel( @@ -110,7 +109,7 @@ export class QcFlagsModel extends Observable { () => { this.model.router.go(buildUrl( '/', - { page: 'runs-per-data-pass', dataPassId, pdpBeamTypes }, + { page: 'runs-per-data-pass', dataPassId }, )); }, ); @@ -192,10 +191,9 @@ export class QcFlagsModel extends Observable { * @param {object} parameters parameters for the model * @param {number} parameters.simulationPassId - The simulation pass ID * @param {string} parameters.runNumberDetectorsMap - String representation of run number to detector map - * @param {string} parameters.pdpBeamTypes the beam types of the runs to display * @returns {void} */ - loadCreationForSimulationPass({ simulationPassId, runNumberDetectorsMap, pdpBeamTypes }) { + loadCreationForSimulationPass({ simulationPassId, runNumberDetectorsMap }) { const parsedRunNumberDetectorMap = this._parseRunNumberDetectorMap(runNumberDetectorsMap ?? ''); this._creationForSimulationPassModel = new QcFlagCreationForSimulationPassModel( @@ -204,7 +202,7 @@ export class QcFlagsModel extends Observable { () => { this.model.router.go(buildUrl( '/', - { page: 'runs-per-simulation-pass', simulationPassId, pdpBeamTypes }, + { page: 'runs-per-simulation-pass', simulationPassId }, )); }, ); From b3641401e77038ed184f70805e92d67e6cb0613d Mon Sep 17 00:00:00 2001 From: xsalonx Date: Tue, 2 Sep 2025 14:33:16 +0200 Subject: [PATCH 19/22] typo --- lib/public/views/Runs/RunsModel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/public/views/Runs/RunsModel.js b/lib/public/views/Runs/RunsModel.js index 5952f83e3a..ba30c3519a 100644 --- a/lib/public/views/Runs/RunsModel.js +++ b/lib/public/views/Runs/RunsModel.js @@ -85,8 +85,8 @@ export class RunsModel extends Observable { /** * Load runs overview data * @param {object} params the parameters for the model - * @param {string} params.lhcPeriodId the name of the LHC period to display - * @param {string} params.panel the key of the panel to display + * @param {string} params.lhcPeriodId id of the LHC period to display + * @param {string} params.panel key of the panel to display * @return {void} */ loadPerLhcPeriodOverview({ lhcPeriodId, panel }) { From f2badc6245a138eb468664e1e7f314d5d7f923b0 Mon Sep 17 00:00:00 2001 From: xsalonx Date: Tue, 2 Sep 2025 14:37:05 +0200 Subject: [PATCH 20/22] cleanup --- test/public/runs/runsPerSimulationPass.overview.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/public/runs/runsPerSimulationPass.overview.test.js b/test/public/runs/runsPerSimulationPass.overview.test.js index acc591558a..f7489050ff 100644 --- a/test/public/runs/runsPerSimulationPass.overview.test.js +++ b/test/public/runs/runsPerSimulationPass.overview.test.js @@ -75,7 +75,7 @@ module.exports = () => { }); it('loads the page successfully', async () => { - const response = await goToPage(page, 'runs-per-simulation-pass', { queryParameters: { simulationPassId: 2, pdp } }); + const response = await goToPage(page, 'runs-per-simulation-pass', { queryParameters: { simulationPassId: 2 } }); // We expect the page to return the correct status code, making sure the server is running properly expect(response.status()).to.equal(200); From 81962a0586beb550f396901b96569db0cae350d5 Mon Sep 17 00:00:00 2001 From: xsalonx Date: Tue, 2 Sep 2025 14:48:45 +0200 Subject: [PATCH 21/22] fix --- .../services/lhcPeriod/LhcPeriodStatisticsService.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lib/server/services/lhcPeriod/LhcPeriodStatisticsService.test.js b/test/lib/server/services/lhcPeriod/LhcPeriodStatisticsService.test.js index 981fb94a82..4e96f810aa 100644 --- a/test/lib/server/services/lhcPeriod/LhcPeriodStatisticsService.test.js +++ b/test/lib/server/services/lhcPeriod/LhcPeriodStatisticsService.test.js @@ -55,7 +55,7 @@ const lhcPeriod_LHC23f = { id: 3, name: 'LHC23f', }, - beamTypes: ['OO'], + pdpBeamTypes: ['OO'], distinctEnergies: [], dataPassesCount: 1, runsCount: 1, From 26f8175d097bfa182c8b17a18f97dc1596433509 Mon Sep 17 00:00:00 2001 From: xsalonx Date: Tue, 2 Sep 2025 14:49:12 +0200 Subject: [PATCH 22/22] fix --- test/api/lhcPeriodsStatistics.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/api/lhcPeriodsStatistics.test.js b/test/api/lhcPeriodsStatistics.test.js index e6f2f66c00..8b3a78c2d4 100644 --- a/test/api/lhcPeriodsStatistics.test.js +++ b/test/api/lhcPeriodsStatistics.test.js @@ -54,7 +54,7 @@ const lhcPeriod_LHC23f = { id: 3, name: 'LHC23f', }, - beamTypes: ['OO'], + pdpBeamTypes: ['OO'], distinctEnergies: [], dataPassesCount: 1, runsCount: 1,