-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathRunsPerSimulationPassOverviewPage.js
More file actions
129 lines (121 loc) · 5.81 KB
/
Copy pathRunsPerSimulationPassOverviewPage.js
File metadata and controls
129 lines (121 loc) · 5.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/**
* @license
* Copyright CERN and copyright holders of ALICE O2. This software is
* distributed under the terms of the GNU General Public License v3 (GPL
* Version 3), copied verbatim in the file "COPYING".
*
* See http://alice-o2.web.cern.ch/license for full licensing information.
*
* In applying this license CERN does not waive the privileges and immunities
* granted to it by virtue of its status as an Intergovernmental Organization
* or submit itself to any jurisdiction.
*/
import { h } from '/js/src/index.js';
import { table } from '../../../components/common/table/table.js';
import { paginationComponent } from '../../../components/Pagination/paginationComponent.js';
import { estimateDisplayableRowsCount } from '../../../utilities/estimateDisplayableRowsCount.js';
import { exportRunsTriggerAndModal } from '../Overview/exportRunsTriggerAndModal.js';
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';
const TABLEROW_HEIGHT = 59;
// Estimate of the navbar and pagination elements height total; Needs to be updated in case of changes;
const PAGE_USED_HEIGHT = 215;
/**
* Return specific classes to style row of run which is not subject to QC
*
* @param {Run} run a run
* @return {string|null} css classes
*/
const getRowClasses = (run) => isRunNotSubjectToQc(run) ? '.danger' : null;
/**
* Render Runs Per LHC Period overview page
* @param {Model} model The overall model object.
* @return {Component} The overview page
*/
export const RunsPerSimulationPassOverviewPage = ({
runs: { perSimulationPassOverviewModel },
dplDetectorsUserHasAccessTo: remoteDplDetectorsUserHasAccessTo,
modalModel,
}) => {
perSimulationPassOverviewModel.pagination.provideDefaultItemsPerPage(estimateDisplayableRowsCount(
TABLEROW_HEIGHT,
PAGE_USED_HEIGHT,
));
const {
items: remoteRuns,
detectors: remoteDetectors,
simulationPass: remoteSimulationPass,
simulationPassId,
qcSummary: remoteQcSummary,
displayOptions,
sortModel,
} = perSimulationPassOverviewModel;
const commonTitle = h('h2', 'Runs per MC');
return h('.intermediate-flex-column', mergeRemoteData([remoteSimulationPass, remoteRuns, remoteDetectors, remoteQcSummary]).match({
NotAsked: () => null,
Failure: (errors) => errorAlert(errors),
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 : {},
...createRunDetectorsAsyncQcActiveColumns(
perSimulationPassOverviewModel.runDetectorsSelectionModel,
detectors,
remoteDplDetectorsUserHasAccessTo,
{ simulationPass },
{
profiles: 'runsPerSimulationPass',
qcSummary,
},
),
};
return [
h('.flex-row.justify-between.items-center.g2', [
h(
'.flex-row.g1.items-center',
breadcrumbs([commonTitle, h('h2#breadcrumb-simulation-pass-name', simulationPass.name)]),
),
h('.mlauto', qcSummaryLegendTooltip()),
exportRunsTriggerAndModal(perSimulationPassOverviewModel, modalModel, { autoMarginLeft: false }),
frontLink(
h(
'button.btn.btn-primary.w-100.h2}#set-qc-flags-trigger',
{
disabled: perSimulationPassOverviewModel.runDetectorsSelectionModel.selectedQueryString.length < 1,
},
'Set QC Flags',
),
'qc-flag-creation-for-simulation-pass',
{
runNumberDetectorsMap: perSimulationPassOverviewModel.runDetectorsSelectionModel.selectedQueryString,
simulationPassId,
},
),
]),
table(
runs,
activeColumns,
{ classes: getRowClasses },
{
profile: 'runsPerSimulationPass',
...displayOptions,
},
{ sort: sortModel },
),
paginationComponent(perSimulationPassOverviewModel.pagination),
];
},
Loading: () => spinner(),
}));
};