Skip to content

Commit 869c999

Browse files
committed
fixes, refactor
1 parent 69add7e commit 869c999

13 files changed

Lines changed: 73 additions & 60 deletions

File tree

lib/database/adapters/SimulationPassAdapter.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class SimulationPassAdapter {
4242

4343
const dataPassesCount = databaseObject.get('dataPassesCount');
4444
const runsCount = databaseObject.get('runsCount');
45+
const pdpBeamTypes = databaseObject.get('pdpBeamTypes');
4546

4647
return {
4748
id,
@@ -54,6 +55,7 @@ class SimulationPassAdapter {
5455
outputSize,
5556
runsCount,
5657
dataPassesCount,
58+
pdpBeamTypes,
5759
};
5860
}
5961
}

lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const dataPassesActiveColumns = {
5252
: frontLink(
5353
badge(runsCount),
5454
'runs-per-data-pass',
55-
{ dataPassId: id, pdpBeamType },
55+
{ dataPassId: id, pdpBeamTypes: pdpBeamType },
5656
),
5757
classes: 'w-10',
5858
},
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* @license
3+
* Copyright CERN and copyright holders of ALICE O2. This software is
4+
* distributed under the terms of the GNU General Public License v3 (GPL
5+
* Version 3), copied verbatim in the file "COPYING".
6+
*
7+
* See http://alice-o2.web.cern.ch/license for full licensing information.
8+
*
9+
* In applying this license CERN does not waive the privileges and immunities
10+
* granted to it by virtue of its status as an Intergovernmental Organization
11+
* or submit itself to any jurisdiction.
12+
*/
13+
14+
import { PdpBeamType } from '../../../domain/enums/PdpBeamType.js';
15+
import { inelasticInteractionRateActiveColumnsForPbPb as inelForPbPb } from './inelasticInteractionRateActiveColumnsForPbPb.js';
16+
import { inelasticInteractionRateActiveColumnsForProtonProton as inelForPP } from './inelasticInteractionRateActiveColumnsForProtonProton.js';
17+
18+
/**
19+
* Get appropriate runs' activate columns dependent on their pdp beam types
20+
*
21+
* @param {string[]} pdpBeamTypes lit of pdp beam types
22+
* @return {ActiveColumn} active column
23+
*/
24+
export const getInelasticInteractionRateColumns = (pdpBeamTypes) => ({
25+
...pdpBeamTypes.includes(PdpBeamType.LEAD_LEAD) ? inelForPbPb : {},
26+
...pdpBeamTypes.includes(PdpBeamType.PROTON_PROTON) ? inelForPP : {},
27+
...pdpBeamTypes.length === 0 ? { ...inelForPP, ...inelForPbPb } : {},
28+
});

lib/public/views/Runs/Overview/FixedPdpBeamTypeRunsOverviewModel.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,24 @@ export class FixedPdpBeamTypeRunsOverviewModel extends RunsWithQcModel {
2626
*/
2727
constructor(model) {
2828
super(model);
29-
this._pdpBeamType = null;
29+
this._pdpBeamTypes = null;
3030
}
3131

3232
/**
3333
* Get pdp_beam_type of fetched runs
3434
*
35-
* @return {string} beam type
35+
* @return {string[]} beam type
3636
*/
3737
get pdpBeamTypes() {
38-
return this._pdpBeamType;
38+
return this._pdpBeamTypes;
3939
}
4040

4141
/**
4242
* Set pdp_beam_type of fetched runs
4343
*
44-
* @param {string} pdpBeamType beam type
44+
* @param {string|string[]} pdpBeamTypes beam type
4545
*/
46-
set pdpBeamTypes(pdpBeamType) {
47-
this._pdpBeamType = pdpBeamType;
46+
set pdpBeamTypes(pdpBeamTypes) {
47+
this._pdpBeamTypes = typeof pdpBeamTypes === 'string' ? pdpBeamTypes.split(',') : pdpBeamTypes;
4848
}
4949
}

lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewPage.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* or submit itself to any jurisdiction.
1212
*/
1313

14-
import { DropdownComponent, h, iconWarning, sessionService, switchCase } from '/js/src/index.js';
14+
import { DropdownComponent, h, iconWarning, sessionService } from '/js/src/index.js';
1515
import { table } from '../../../components/common/table/table.js';
1616
import { paginationComponent } from '../../../components/Pagination/paginationComponent.js';
1717
import { estimateDisplayableRowsCount } from '../../../utilities/estimateDisplayableRowsCount.js';
@@ -21,8 +21,6 @@ import spinner from '../../../components/common/spinner.js';
2121
import { tooltip } from '../../../components/common/popover/tooltip.js';
2222
import { breadcrumbs } from '../../../components/common/navigation/breadcrumbs.js';
2323
import { createRunDetectorsAsyncQcActiveColumns } from '../ActiveColumns/runDetectorsAsyncQcActiveColumns.js';
24-
import { inelasticInteractionRateActiveColumnsForPbPb } from '../ActiveColumns/inelasticInteractionRateActiveColumnsForPbPb.js';
25-
import { inelasticInteractionRateActiveColumnsForProtonProton } from '../ActiveColumns/inelasticInteractionRateActiveColumnsForProtonProton.js';
2624
import { filtersPanelPopover } from '../../../components/Filters/common/filtersPanelPopover.js';
2725
import { runNumbersFilter } from '../../../components/Filters/RunsFilter/runNumbersFilter.js';
2826
import { qcSummaryLegendTooltip } from '../../../components/qcFlags/qcSummaryLegendTooltip.js';
@@ -39,6 +37,7 @@ import { mergeRemoteData } from '../../../utilities/mergeRemoteData.js';
3937
import { numericalComparisonFilter } from '../../../components/Filters/common/filters/numericalComparisonFilter.js';
4038
import { iconCaretBottom } from '/js/src/icons.js';
4139
import { BkpRoles } from '../../../domain/enums/BkpRoles.js';
40+
import { getInelasticInteractionRateColumns } from '../ActiveColumns/getInelasticInteractionRateActiveColumns.js';
4241

4342
const TABLEROW_HEIGHT = 59;
4443
// Estimate of the navbar and pagination elements height total; Needs to be updated in case of changes;
@@ -121,7 +120,7 @@ export const RunsPerDataPassOverviewPage = ({
121120
dataPassId,
122121
sortModel,
123122
mcReproducibleAsNotBad,
124-
pdpBeamType,
123+
pdpBeamTypes,
125124
markAsSkimmableRequestResult,
126125
skimmableRuns: remoteSkimmableRuns,
127126
freezeOrUnfreezeActionState,
@@ -140,17 +139,7 @@ export const RunsPerDataPassOverviewPage = ({
140139
Success: ([dataPass, runs, detectors, qcSummary, gaqSummary]) => {
141140
const activeColumns = {
142141
...runsActiveColumns,
143-
...switchCase(
144-
pdpBeamType,
145-
{
146-
[PdpBeamType.PROTON_PROTON]: inelasticInteractionRateActiveColumnsForProtonProton,
147-
[PdpBeamType.LEAD_LEAD]: inelasticInteractionRateActiveColumnsForPbPb,
148-
},
149-
{
150-
...inelasticInteractionRateActiveColumnsForProtonProton,
151-
...inelasticInteractionRateActiveColumnsForPbPb,
152-
},
153-
),
142+
...getInelasticInteractionRateColumns(pdpBeamTypes),
154143
...dataPass.skimmingStage === SkimmingStage.SKIMMABLE
155144
? {
156145
readyForSkimming: {

lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewModel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
import { buildUrl, RemoteData } from '/js/src/index.js';
1414
import { TabbedPanelModel } from '../../../components/TabbedPanel/TabbedPanelModel.js';
1515
import { detectorsProvider } from '../../../services/detectors/detectorsProvider.js';
16-
import { RunsWithQcModel } from '../Overview/RunsWithQcModel.js';
1716
import { jsonFetch } from '../../../utilities/fetch/jsonFetch.js';
17+
import { FixedPdpBeamTypeRunsOverviewModel } from '../Overview/FixedPdpBeamTypeRunsOverviewModel.js';
1818

1919
export const RUNS_PER_LHC_PERIOD_PANELS_KEYS = {
2020
DETECTOR_QUALITIES: 'detectorQualities',
@@ -24,7 +24,7 @@ export const RUNS_PER_LHC_PERIOD_PANELS_KEYS = {
2424
/**
2525
* Runs Per LHC Period overview model
2626
*/
27-
export class RunsPerLhcPeriodOverviewModel extends RunsWithQcModel {
27+
export class RunsPerLhcPeriodOverviewModel extends FixedPdpBeamTypeRunsOverviewModel {
2828
/**
2929
* Constructor
3030
*

lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewPage.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ import { estimateDisplayableRowsCount } from '../../../utilities/estimateDisplay
1818
import { exportRunsTriggerAndModal } from '../Overview/exportRunsTriggerAndModal.js';
1919
import { runsActiveColumns } from '../ActiveColumns/runsActiveColumns.js';
2020
import { runDetectorsQualitiesActiveColumns } from '../ActiveColumns/runDetectorsQualitiesActiveColumns.js';
21-
import { inelasticInteractionRateActiveColumnsForProtonProton } from '../ActiveColumns/inelasticInteractionRateActiveColumnsForProtonProton.js';
22-
import { inelasticInteractionRateActiveColumnsForPbPb } from '../ActiveColumns/inelasticInteractionRateActiveColumnsForPbPb.js';
2321
import { isRunNotSubjectToQc } from '../../../components/qcFlags/isRunNotSubjectToQc.js';
2422
import { runDetectorsSyncQcActiveColumns } from '../ActiveColumns/runDetectorsSyncQcActiveColumns.js';
2523
import { tabbedPanelComponent } from '../../../components/TabbedPanel/tabbedPanelComponent.js';
2624
import { RUNS_PER_LHC_PERIOD_PANELS_KEYS } from './RunsPerLhcPeriodOverviewModel.js';
27-
import { PdpBeamType } from '../../../domain/enums/PdpBeamType.js';
25+
import { getInelasticInteractionRateColumns } from '../ActiveColumns/getInelasticInteractionRateActiveColumns.js';
2826

2927
const TABLEROW_HEIGHT = 62;
3028
// 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
5856
displayOptions,
5957
sortModel,
6058
tabbedPanelModel,
59+
pdpBeamTypes,
6160
} = perLhcPeriodOverviewModel;
6261

6362
const activeColumns = {
6463
...runsActiveColumns,
65-
...remoteRuns.match({
66-
Success: (runs) => runs.some((run) => run.pdpBeamType === PdpBeamType.LEAD_LEAD)
67-
? inelasticInteractionRateActiveColumnsForPbPb
68-
: {},
69-
Other: () => {},
70-
}),
71-
...remoteRuns.match({
72-
Success: (runs) => runs.some((run) => run.pdpBeamType === PdpBeamType.PROTON_PROTON)
73-
? inelasticInteractionRateActiveColumnsForProtonProton
74-
: {},
75-
Other: () => {},
76-
}),
64+
...getInelasticInteractionRateColumns(pdpBeamTypes),
7765
};
7866

7967
/**

lib/public/views/Runs/RunsModel.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,16 @@ export class RunsModel extends Observable {
8585
/**
8686
* Load runs overview data
8787
* @param {object} params the parameters for the model
88-
* @param {string} [params.lhcPeriodName] the name of the LHC period to display
89-
* @param {string} [params.panel] the key of the panel to display
88+
* @param {string} params.lhcPeriodName the name of the LHC period to display
89+
* @param {string} params.panel the key of the panel to display
90+
* @param {string} params.pdpBeamTypes the key of the panel to display
9091
* @return {void}
9192
*/
92-
loadPerLhcPeriodOverview({ lhcPeriodName, panel }) {
93+
loadPerLhcPeriodOverview({ lhcPeriodName, panel, pdpBeamTypes }) {
9394
this._perLhcPeriodOverviewModel.tabbedPanelModel.currentPanelKey = panel;
9495
if (!this._perLhcPeriodOverviewModel.pagination.isInfiniteScrollEnabled) {
9596
this._perLhcPeriodOverviewModel.lhcPeriodName = lhcPeriodName;
97+
this._perLhcPeriodOverviewModel.pdpBeamTypes = pdpBeamTypes;
9698
this._perLhcPeriodOverviewModel.load();
9799
}
98100
}
@@ -108,14 +110,14 @@ export class RunsModel extends Observable {
108110
/**
109111
* Load runs overview data
110112
* @param {object} params the parameters for the model
111-
* @param {string} [params.dataPassId] the id of the data pass to display
112-
* @param {string} [params.pdpBeamType] the beam type of the data pass to display
113+
* @param {string} params.dataPassId the id of the data pass to display
114+
* @param {string} params.pdpBeamTypes the beam types of the runs to display
113115
* @return {void}
114116
*/
115-
loadPerDataPassOverview({ dataPassId, pdpBeamType }) {
117+
loadPerDataPassOverview({ dataPassId, pdpBeamTypes }) {
116118
if (!this._perDataPassOverviewModel.pagination.isInfiniteScrollEnabled) {
117119
this._perDataPassOverviewModel.dataPassId = parseInt(dataPassId, 10);
118-
this._perDataPassOverviewModel.pdpBeamType = pdpBeamType;
120+
this._perDataPassOverviewModel.pdpBeamTypes = pdpBeamTypes;
119121
this._perDataPassOverviewModel.load();
120122
}
121123
}
@@ -130,13 +132,15 @@ export class RunsModel extends Observable {
130132

131133
/**
132134
* Load runs overview per simulation pass data
133-
* @param {object} root0 - The parameters for the model.
134-
* @param {string} root0.simulationPassId - The ID of the simulation pass to load.
135+
* @param {object} params - The parameters for the model.
136+
* @param {string} params.simulationPassId - The ID of the simulation pass to load.
137+
* @param {string} params.pdpBeamTypes the beam types of the runs to display
135138
* @return {void}
136139
*/
137-
loadPerSimulationPassOverview({ simulationPassId }) {
140+
loadPerSimulationPassOverview({ simulationPassId, pdpBeamTypes }) {
138141
if (!this._perSimulationPassOverviewModel.pagination.isInfiniteScrollEnabled) {
139142
this._perSimulationPassOverviewModel.simulationPassId = parseInt(simulationPassId, 10);
143+
this._perSimulationPassOverviewModel.pdpBeamTypes = pdpBeamTypes;
140144
this._perSimulationPassOverviewModel.load();
141145
}
142146
}

lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewModel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
* or submit itself to any jurisdiction.
1212
*/
1313
import { buildUrl, RemoteData } from '/js/src/index.js';
14-
import { RunsWithQcModel } from '../Overview/RunsWithQcModel.js';
1514
import { ObservableData } from '../../../utilities/ObservableData.js';
1615
import { getRemoteData } from '../../../utilities/fetch/getRemoteData.js';
1716
import { detectorsProvider } from '../../../services/detectors/detectorsProvider.js';
1817
import { RunDetectorsSelectionModel } from '../RunDetectorsSelectionModel.js';
18+
import { FixedPdpBeamTypeRunsOverviewModel } from '../Overview/FixedPdpBeamTypeRunsOverviewModel.js';
1919

2020
/**
2121
* Runs Per Simulation Pass overview model
2222
*/
23-
export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel {
23+
export class RunsPerSimulationPassOverviewModel extends FixedPdpBeamTypeRunsOverviewModel {
2424
/**
2525
* Constructor
2626
* @param {Model} model global model

lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewPage.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@ import { runsActiveColumns } from '../ActiveColumns/runsActiveColumns.js';
2020
import { breadcrumbs } from '../../../components/common/navigation/breadcrumbs.js';
2121
import spinner from '../../../components/common/spinner.js';
2222
import { createRunDetectorsAsyncQcActiveColumns } from '../ActiveColumns/runDetectorsAsyncQcActiveColumns.js';
23-
import { inelasticInteractionRateActiveColumnsForPbPb } from '../ActiveColumns/inelasticInteractionRateActiveColumnsForPbPb.js';
24-
import { inelasticInteractionRateActiveColumnsForProtonProton } from '../ActiveColumns/inelasticInteractionRateActiveColumnsForProtonProton.js';
2523
import { qcSummaryLegendTooltip } from '../../../components/qcFlags/qcSummaryLegendTooltip.js';
2624
import { isRunNotSubjectToQc } from '../../../components/qcFlags/isRunNotSubjectToQc.js';
27-
import { PdpBeamType } from '../../../domain/enums/PdpBeamType.js';
2825
import { frontLink } from '../../../components/common/navigation/frontLink.js';
2926
import { mergeRemoteData } from '../../../utilities/mergeRemoteData.js';
3027
import errorAlert from '../../../components/common/errorAlert.js';
28+
import { getInelasticInteractionRateColumns } from '../ActiveColumns/getInelasticInteractionRateActiveColumns.js';
3129

3230
const TABLEROW_HEIGHT = 59;
3331
// Estimate of the navbar and pagination elements height total; Needs to be updated in case of changes;
@@ -64,6 +62,7 @@ export const RunsPerSimulationPassOverviewPage = ({
6462
qcSummary: remoteQcSummary,
6563
displayOptions,
6664
sortModel,
65+
pdpBeamTypes,
6766
} = perSimulationPassOverviewModel;
6867

6968
const commonTitle = h('h2', 'Runs per MC');
@@ -74,8 +73,7 @@ export const RunsPerSimulationPassOverviewPage = ({
7473
Success: ([simulationPass, runs, detectors, qcSummary]) => {
7574
const activeColumns = {
7675
...runsActiveColumns,
77-
...runs.some((run) => run.pdpBeamType === PdpBeamType.LEAD_LEAD) ? inelasticInteractionRateActiveColumnsForPbPb : {},
78-
...runs.some((run) => run.pdpBeamType === PdpBeamType.PROTON_PROTON) ? inelasticInteractionRateActiveColumnsForProtonProton : {},
76+
...getInelasticInteractionRateColumns(pdpBeamTypes),
7977
...createRunDetectorsAsyncQcActiveColumns(
8078
perSimulationPassOverviewModel.runDetectorsSelectionModel,
8179
detectors,

0 commit comments

Comments
 (0)