@@ -24,6 +24,12 @@ import { runDetectorsSyncQcActiveColumns } from '../ActiveColumns/runDetectorsSy
2424import { tabbedPanelComponent } from '../../../components/TabbedPanel/tabbedPanelComponent.js' ;
2525import { RUNS_PER_LHC_PERIOD_PANELS_KEYS } from './RunsPerLhcPeriodOverviewModel.js' ;
2626import { PdpBeamType } from '../../../domain/enums/PdpBeamType.js' ;
27+ import { filtersPanelPopover } from '../../../components/Filters/common/filtersPanelPopover.js' ;
28+ import { runNumbersFilter } from '../../../components/Filters/RunsFilter/runNumbersFilter.js' ;
29+ import { mergeRemoteData } from '../../../utilities/mergeRemoteData.js' ;
30+ import errorAlert from '../../../components/common/errorAlert.js' ;
31+ import spinner from '../../../components/common/spinner.js' ;
32+ import { mcReproducibleAsNotBadToggle } from '../mcReproducibleAsNotBadToggle.js' ;
2733import { exportTriggerAndModal } from '../../../components/common/dataExport/exportTriggerAndModal.js' ;
2834
2935const TABLEROW_HEIGHT = 62 ;
@@ -53,44 +59,29 @@ export const RunsPerLhcPeriodOverviewPage = ({ runs: { perLhcPeriodOverviewModel
5359
5460 const {
5561 items : remoteRuns ,
62+ lhcPeriodStatistics : remoteLhcPeriodStatistics ,
5663 onlineDetectors : remoteOnlineDetectors ,
5764 syncDetectors : remoteSyncDetectors ,
58- lhcPeriodName,
5965 displayOptions,
6066 sortModel,
6167 tabbedPanelModel,
68+ mcReproducibleAsNotBad,
6269 } = perLhcPeriodOverviewModel ;
6370
64- const activeColumns = {
65- ...runsActiveColumns ,
66- ...remoteRuns . match ( {
67- Success : ( runs ) => runs . some ( ( run ) => run . pdpBeamType === PdpBeamType . LEAD_LEAD )
68- ? inelasticInteractionRateActiveColumnsForPbPb
69- : { } ,
70- Other : ( ) => { } ,
71- } ) ,
72- ...remoteRuns . match ( {
73- Success : ( runs ) => runs . some ( ( run ) => run . pdpBeamType === PdpBeamType . PROTON_PROTON )
74- ? inelasticInteractionRateActiveColumnsForProtonProton
75- : { } ,
76- Other : ( ) => { } ,
77- } ) ,
78- } ;
79-
8071 /**
8172 * Render runs table with given detectors' active columns configuration
8273 *
83- * @param {object } detectorsActiveColumns active columns
74+ * @param {object } activeColumns common acctivte column
75+ * @param {object } detectorsActiveColumns detectors specific columns
8476 * @return {Component } table with pagination
8577 */
86- const getTableWithGivenDetectorsColumns = ( detectorsActiveColumns ) =>
78+ const getTableWithGivenDetectorsColumns = ( activeColumns , detectorsActiveColumns ) =>
8779 table (
8880
8981 /*
9082 * Columns depends on detectors' list, it's not useful to render the table when detectors are missing
91- * TODO replace by RemoteData merging
9283 */
93- remoteOnlineDetectors . match ( { Success : ( ) => remoteRuns , Other : ( ) => remoteOnlineDetectors } ) ,
84+ remoteRuns ,
9485 {
9586 ...activeColumns ,
9687 ...detectorsActiveColumns ,
@@ -104,37 +95,69 @@ export const RunsPerLhcPeriodOverviewPage = ({ runs: { perLhcPeriodOverviewModel
10495 { sort : sortModel } ,
10596 ) ;
10697
107- return h ( '.intermediate-flex-column' , [
108- h ( '.flex-row.justify-between.g2' , [
109- h ( 'h2' , `Good, physics runs of ${ lhcPeriodName } ` ) ,
110- exportTriggerAndModal ( perLhcPeriodOverviewModel . exportModel , modalModel ) ,
111- ] ) ,
112- ...tabbedPanelComponent (
113- tabbedPanelModel ,
114- {
115- [ RUNS_PER_LHC_PERIOD_PANELS_KEYS . DETECTOR_QUALITIES ] : 'Qualities of detectors' ,
116- [ RUNS_PER_LHC_PERIOD_PANELS_KEYS . SYNCHRONOUS_FLAGS ] : 'Synchronous QC flags' ,
117- } ,
118- {
119- [ RUNS_PER_LHC_PERIOD_PANELS_KEYS . DETECTOR_QUALITIES ] :
120- ( ) => getTableWithGivenDetectorsColumns ( runDetectorsQualitiesActiveColumns (
121- remoteOnlineDetectors . match ( { Success : ( payload ) => payload , Other : ( ) => [ ] } ) ,
122- { profiles : 'runsPerLhcPeriod' } ,
123- ) ) ,
98+ return h (
99+ '.intermediate-flex-column' ,
100+ { onremove : ( ) => perLhcPeriodOverviewModel . reset ( false ) } ,
101+ mergeRemoteData ( [ remoteLhcPeriodStatistics , remoteRuns ] ) . match ( {
102+ NotAsked : ( ) => null ,
103+ Failure : ( errors ) => errorAlert ( errors ) ,
104+ Loading : ( ) => spinner ( ) ,
105+ Success : ( [ lhcPeriodStatistics , runs ] ) => {
106+ const activeColumns = {
107+ ...runsActiveColumns ,
108+ ...runs . some ( ( run ) => run . pdpBeamType === PdpBeamType . LEAD_LEAD ) ? inelasticInteractionRateActiveColumnsForPbPb : { } ,
109+ ...runs . some ( ( run ) => run . pdpBeamType === PdpBeamType . PROTON_PROTON )
110+ ? inelasticInteractionRateActiveColumnsForProtonProton : { } ,
111+ } ;
124112
125- [ RUNS_PER_LHC_PERIOD_PANELS_KEYS . SYNCHRONOUS_FLAGS ] :
126- ( remoteSynchronousQcSummary ) => getTableWithGivenDetectorsColumns ( runDetectorsSyncQcActiveColumns (
127- remoteSyncDetectors . match ( { Success : ( payload ) => payload , Other : ( ) => [ ] } ) ,
113+ return [
114+ h ( '.flex-row.justify-between.items-center.g2' , [
115+ filtersPanelPopover ( perLhcPeriodOverviewModel , activeColumns , { profile : 'runsPerLhcPeriod' } ) ,
116+ h ( '.pl2#runOverviewFilter' , runNumbersFilter ( perLhcPeriodOverviewModel . filteringModel . get ( 'runNumbers' ) ) ) ,
117+ h ( 'h2' , `Good, physics runs of ${ lhcPeriodStatistics . lhcPeriod . name } ` ) ,
118+ mcReproducibleAsNotBadToggle (
119+ mcReproducibleAsNotBad ,
120+ ( ) => perLhcPeriodOverviewModel . setMcReproducibleAsNotBad ( ! mcReproducibleAsNotBad ) ,
121+ ) ,
122+ exportTriggerAndModal ( perLhcPeriodOverviewModel . exportModel , modalModel ) ,
123+ ] ) ,
124+ ...tabbedPanelComponent (
125+ tabbedPanelModel ,
128126 {
129- profiles : 'runsPerLhcPeriod ' ,
130- qcSummary : remoteSynchronousQcSummary . match ( { Success : ( qcSummary ) => qcSummary , Other : ( ) => null } ) ,
127+ [ RUNS_PER_LHC_PERIOD_PANELS_KEYS . DETECTOR_QUALITIES ] : 'Qualities of detectors ' ,
128+ [ RUNS_PER_LHC_PERIOD_PANELS_KEYS . SYNCHRONOUS_FLAGS ] : 'Synchronous QC flags' ,
131129 } ,
132- ) ) ,
133- } ,
134- {
135- panelClass : [ 'scroll-auto' ] ,
130+ {
131+ [ RUNS_PER_LHC_PERIOD_PANELS_KEYS . DETECTOR_QUALITIES ] : ( ) => remoteOnlineDetectors . match ( {
132+ Success : ( onlineDetectors ) => getTableWithGivenDetectorsColumns (
133+ activeColumns ,
134+ runDetectorsQualitiesActiveColumns ( onlineDetectors , { profiles : 'runsPerLhcPeriod' } ) ,
135+ ) ,
136+ NotAsked : ( ) => null ,
137+ Failure : ( errors ) => errorAlert ( errors ) ,
138+ Loading : ( ) => spinner ( ) ,
139+ } ) ,
140+
141+ [ RUNS_PER_LHC_PERIOD_PANELS_KEYS . SYNCHRONOUS_FLAGS ] : ( remoteSynchronousQcSummary ) =>
142+ mergeRemoteData ( [ remoteSynchronousQcSummary , remoteSyncDetectors ] ) . match ( {
143+ Success : ( [ synchronousQcSummary , syncDetectors ] ) => getTableWithGivenDetectorsColumns (
144+ activeColumns ,
145+ runDetectorsSyncQcActiveColumns ( syncDetectors , {
146+ profiles : 'runsPerLhcPeriod' ,
147+ qcSummary : synchronousQcSummary ,
148+ } ) ,
149+ ) ,
150+ NotAsked : ( ) => null ,
151+ Failure : ( errors ) => errorAlert ( errors ) ,
152+ Loading : ( ) => spinner ( ) ,
153+ } ) ,
154+ } ,
155+ { panelClass : [ 'scroll-auto' ] } ,
156+ ) ,
157+ paginationComponent ( perLhcPeriodOverviewModel . pagination ) ,
158+ ] ;
136159 } ,
137- ) ,
138- paginationComponent ( perLhcPeriodOverviewModel . pagination ) ,
139- ] ) ;
160+ } ) ,
161+
162+ ) ;
140163} ;
0 commit comments