@@ -118,176 +118,181 @@ export const RunsPerDataPassOverviewPage = ({
118118 const commonTitle = h ( 'h2#breadcrumb-header' , { style : 'white-space: nowrap;' } , 'Physics Runs' ) ;
119119 const runDetectorsSelectionIsEmpty = perDataPassOverviewModel . runDetectorsSelectionModel . selectedQueryString . length === 0 ;
120120
121- return h (
122- '.intermediate-flex-column' ,
123- { onremove : ( ) => {
124- perDataPassOverviewModel . _abortGaqFetches ( ) ;
125- } } ,
126- mergeRemoteData ( [ remoteDataPass , remoteRuns , remoteDetectors , remoteQcSummary ] ) . match ( {
127- NotAsked : ( ) => null ,
128- Failure : ( errors ) => errorAlert ( errors ) ,
129- Success : ( [ dataPass , runs , detectors , qcSummary ] ) => {
130- const activeColumns = {
131- ...runsActiveColumns ,
132- ...getInelasticInteractionRateColumns ( pdpBeamTypes ) ,
133- ...dataPass . skimmingStage === SkimmingStage . SKIMMABLE
134- ? {
135- readyForSkimming : {
136- name : 'Ready for skimming' ,
137- visible : true ,
138- format : ( _ , { runNumber } ) => remoteSkimmableRuns . match ( {
139- Success : ( skimmableRuns ) => switchInput (
140- skimmableRuns [ runNumber ] ,
141- ( ) => perDataPassOverviewModel . changeReadyForSkimmingFlagForRun ( {
142- runNumber,
143- readyForSkimming : ! skimmableRuns [ runNumber ] ,
144- } ) ,
145- {
146- labelAfter : skimmableRuns [ runNumber ]
147- ? badge ( 'ready' , { color : Color . GREEN } )
148- : badge ( 'not ready' , { color : Color . WARNING_DARKER } ) ,
149- } ,
150- ) ,
151- Loading : ( ) => h ( '.mh3.ph4' , '... ...' ) ,
152- Failure : ( ) => tooltip ( iconWarning ( ) , 'Error occurred' ) ,
153- NotAsked : ( ) => tooltip ( iconWarning ( ) , 'Not asked for data' ) ,
154- } ) ,
155- profiles : [ 'runsPerDataPass' ] ,
156- } ,
157- }
158- : { } ,
159- globalAggregatedQuality : {
160- name : 'GAQ' ,
161- information : h (
162- '' ,
163- h ( '' , 'Global aggregated flag based on critical detectors.' ) ,
164- h ( '' , 'Default detectors: FT0, ITS, TPC (and ZDC for heavy-ion runs)' ) ,
165- ) ,
166- visible : true ,
167- format : ( _ , { runNumber } ) => {
168- const gaqLoadingSpinner = h ( '.flex-row.items-center.justify-center.black' , spinner ( { size : 2 , absolute : false } ) ) ;
169- const runGaqSummary = remoteGaqSummary [ runNumber ] ;
121+ const activeColumns = {
122+ ...runsActiveColumns ,
123+ ...getInelasticInteractionRateColumns ( pdpBeamTypes ) ,
124+ globalAggregatedQuality : {
125+ name : 'GAQ' ,
126+ information : h (
127+ '' ,
128+ h ( '' , 'Global aggregated flag based on critical detectors.' ) ,
129+ h ( '' , 'Default detectors: FT0, ITS, TPC (and ZDC for heavy-ion runs)' ) ,
130+ ) ,
131+ visible : true ,
132+ format : ( _ , { runNumber } ) => {
133+ const gaqLoadingSpinner = h ( '.flex-row.items-center.justify-center.black' , spinner ( { size : 2 , absolute : false } ) ) ;
134+ const runGaqSummary = remoteGaqSummary [ runNumber ] ;
170135
171- return runGaqSummary . match ( {
172- Success : ( gaqSummary ) => {
173- const gaqDisplay = gaqSummary ?. undefinedQualityPeriodsCount === 0
174- ? getQcSummaryDisplay ( gaqSummary )
175- : h ( 'button.btn.btn-primary.w-100' , 'GAQ' ) ;
136+ return runGaqSummary . match ( {
137+ Success : ( gaqSummary ) => {
138+ const gaqDisplay = gaqSummary ?. undefinedQualityPeriodsCount === 0
139+ ? getQcSummaryDisplay ( gaqSummary )
140+ : h ( 'button.btn.btn-primary.w-100' , 'GAQ' ) ;
176141
177- return frontLink ( gaqDisplay , 'gaq-flags' , { dataPassId, runNumber } ) ;
178- } ,
179- Loading : ( ) => tooltip ( gaqLoadingSpinner , 'Loading GAQ summary...' ) ,
180- NotAsked : ( ) => tooltip ( gaqLoadingSpinner , 'Loading GAQ summary...' ) ,
181- Failure : ( ) => {
182- const gaqDisplay = h ( 'button.btn.btn-primary.w-100' , [
183- 'GAQ' ,
184- h (
185- '.d-inline-block.va-t-bottom' ,
186- tooltip ( h ( '.f7' , iconWarning ( ) ) , 'GAQ Summary failed, please click to view GAQ flags' ) ,
187- ) ,
188- ] ) ;
189- return frontLink ( gaqDisplay , 'gaq-flags' , { dataPassId, runNumber } ) ;
190- } ,
191- } ) ;
192- } ,
193- filter : ( { filteringModel } ) => numericalComparisonFilter (
194- filteringModel . get ( 'gaq[notBadFraction]' ) ,
195- { step : 0.1 , selectorPrefix : 'gaqNotBadFraction' } ,
196- ) ,
197- filterTooltip : 'not-bad fraction expressed as a percentage' ,
198- profiles : [ 'runsPerDataPass' ] ,
142+ return frontLink ( gaqDisplay , 'gaq-flags' , { dataPassId, runNumber } ) ;
143+ } ,
144+ Loading : ( ) => tooltip ( gaqLoadingSpinner , 'Loading GAQ summary...' ) ,
145+ NotAsked : ( ) => tooltip ( gaqLoadingSpinner , 'Loading GAQ summary...' ) ,
146+ Failure : ( ) => {
147+ const gaqDisplay = h ( 'button.btn.btn-primary.w-100' , [
148+ 'GAQ' ,
149+ h (
150+ '.d-inline-block.va-t-bottom' ,
151+ tooltip ( h ( '.f7' , iconWarning ( ) ) , 'GAQ Summary failed, please click to view GAQ flags' ) ,
152+ ) ,
153+ ] ) ;
154+ return frontLink ( gaqDisplay , 'gaq-flags' , { dataPassId, runNumber } ) ;
199155 } ,
200- ...createRunDetectorsAsyncQcActiveColumns (
201- perDataPassOverviewModel . runDetectorsSelectionModel ,
202- detectors ,
203- remoteDplDetectorsUserHasAccessTo ,
204- { dataPass } ,
156+ } ) ;
157+ } ,
158+ filter : ( { filteringModel } ) => numericalComparisonFilter (
159+ filteringModel . get ( 'gaq[notBadFraction]' ) ,
160+ { step : 0.1 , selectorPrefix : 'gaqNotBadFraction' } ,
161+ ) ,
162+ filterTooltip : 'not-bad fraction expressed as a percentage' ,
163+ profiles : [ 'runsPerDataPass' ] ,
164+ } ,
165+ } ;
166+
167+ const dataPass = remoteDataPass . match ( { Other : ( ) => null , Success : ( data ) => data } ) ;
168+ const detectors = remoteDetectors . match ( { Other : ( ) => null , Success : ( data ) => data } ) ;
169+ const qcSummary = remoteQcSummary . match ( { Other : ( ) => null , Success : ( data ) => data } ) ;
170+
171+ if ( dataPass ?. skimmingStage === SkimmingStage . SKIMMABLE ) {
172+ activeColumns . readyForSkimming = {
173+ name : 'Ready for skimming' ,
174+ visible : true ,
175+ format : ( _ , { runNumber } ) => remoteSkimmableRuns . match ( {
176+ Success : ( skimmableRuns ) => switchInput (
177+ skimmableRuns [ runNumber ] ,
178+ ( ) => perDataPassOverviewModel . changeReadyForSkimmingFlagForRun ( {
179+ runNumber,
180+ readyForSkimming : ! skimmableRuns [ runNumber ] ,
181+ } ) ,
182+ {
183+ labelAfter : skimmableRuns [ runNumber ]
184+ ? badge ( 'ready' , { color : Color . GREEN } )
185+ : badge ( 'not ready' , { color : Color . WARNING_DARKER } ) ,
186+ } ,
187+ ) ,
188+ Loading : ( ) => h ( '.mh3.ph4' , '... ...' ) ,
189+ Failure : ( ) => tooltip ( iconWarning ( ) , 'Error occurred' ) ,
190+ NotAsked : ( ) => tooltip ( iconWarning ( ) , 'Not asked for data' ) ,
191+ } ) ,
192+ profiles : [ 'runsPerDataPass' ] ,
193+ } ;
194+ }
195+
196+ detectors && dataPass && Object . assign (
197+ activeColumns ,
198+ createRunDetectorsAsyncQcActiveColumns (
199+ perDataPassOverviewModel . runDetectorsSelectionModel ,
200+ detectors ,
201+ remoteDplDetectorsUserHasAccessTo ,
202+ { dataPass } ,
203+ {
204+ profile : 'runsPerDataPass' ,
205+ qcSummary,
206+ mcReproducibleAsNotBad,
207+ } ,
208+ ) ,
209+ ) ;
210+
211+ return [
212+ h ( '.flex-row.justify-between.items-center.g2' , [
213+ filtersPanelPopover ( perDataPassOverviewModel , activeColumns , { profile : 'runsPerDataPass' } ) ,
214+ h ( '.pl2#runOverviewFilter' , runNumbersFilter ( perDataPassOverviewModel . filteringModel . get ( 'runNumbers' ) ) ) ,
215+ h (
216+ '.flex-row.g1.items-center' ,
217+ h ( '.flex-row.items-center.g1' , [
218+ breadcrumbs ( [ commonTitle , h ( 'h2#breadcrumb-data-pass-name' , dataPass ?. name ) ] ) ,
219+ h ( '#skimmableControl' , dataPass && skimmableControl (
220+ dataPass ,
221+ ( ) => {
222+ if ( confirm ( 'The data pass is going to be set as skimmable. Do you want to continue?' ) ) {
223+ perDataPassOverviewModel . markDataPassAsSkimmable ( ) ;
224+ }
225+ } ,
226+ markAsSkimmableRequestResult ,
227+ ) ) ,
228+ ] ) ,
229+ ) ,
230+ mcReproducibleAsNotBadToggle (
231+ mcReproducibleAsNotBad ,
232+ ( ) => perDataPassOverviewModel . setMcReproducibleAsNotBad ( ! mcReproducibleAsNotBad ) ,
233+ ) ,
234+ h ( '.mlauto' , qcSummaryLegendTooltip ( ) ) ,
235+ h ( '#actions-dropdown-button' , DropdownComponent (
236+ h ( 'button.btn.btn-primary' , h ( '.flex-row.g2' , [ 'Actions' , iconCaretBottom ( ) ] ) ) ,
237+ h ( '.flex-column.p2.g2' , [
238+ exportTriggerAndModal ( perDataPassOverviewModel . exportModel , modalModel , { autoMarginLeft : false } ) ,
239+ frontLink (
240+ h ( 'button.btn.btn-primary.w-100.h2}#set-qc-flags-trigger' , {
241+ disabled : runDetectorsSelectionIsEmpty ,
242+ } , 'Set QC Flags' ) ,
243+ 'qc-flag-creation-for-data-pass' ,
205244 {
206- profile : 'runsPerDataPass' ,
207- qcSummary,
208- mcReproducibleAsNotBad,
245+ runNumberDetectorsMap : perDataPassOverviewModel . runDetectorsSelectionModel . selectedQueryString ,
246+ dataPassId,
209247 } ,
210248 ) ,
211- } ;
212-
213- return [
214- h ( '.flex-row.justify-between.items-center.g2' , [
215- filtersPanelPopover ( perDataPassOverviewModel , activeColumns , { profile : 'runsPerDataPass' } ) ,
216- h ( '.pl2#runOverviewFilter' , runNumbersFilter ( perDataPassOverviewModel . filteringModel . get ( 'runNumbers' ) ) ) ,
249+ sessionService . hasAccess ( [ BkpRoles . DPG_ASYNC_QC_ADMIN ] ) && [
217250 h (
218- '.flex-row.g1.items-center' ,
219- h ( '.flex-row.items-center.g1' , [
220- breadcrumbs ( [ commonTitle , h ( 'h2#breadcrumb-data-pass-name' , dataPass . name ) ] ) ,
221- h ( '#skimmableControl' , skimmableControl (
222- dataPass ,
223- ( ) => {
224- if ( confirm ( 'The data pass is going to be set as skimmable. Do you want to continue?' ) ) {
225- perDataPassOverviewModel . markDataPassAsSkimmable ( ) ;
226- }
227- } ,
228- markAsSkimmableRequestResult ,
229- ) ) ,
230- ] ) ,
251+ 'button.btn.btn-danger' ,
252+ {
253+ ...freezeOrUnfreezeActionState . match ( {
254+ Loading : ( ) => ( {
255+ disabled : true ,
256+ title : 'Loading' ,
257+ } ) ,
258+ Other : ( ) => ( { } ) ,
259+ } ) ,
260+ onclick : ( ) => dataPass . isFrozen
261+ ? perDataPassOverviewModel . unfreezeDataPass ( )
262+ : perDataPassOverviewModel . freezeDataPass ( ) ,
263+ } ,
264+ `${ dataPass . isFrozen ? 'Unfreeze' : 'Freeze' } the data pass` ,
231265 ) ,
232- mcReproducibleAsNotBadToggle (
233- mcReproducibleAsNotBad ,
234- ( ) => perDataPassOverviewModel . setMcReproducibleAsNotBad ( ! mcReproducibleAsNotBad ) ,
266+ h (
267+ 'button.btn.btn-danger' ,
268+ {
269+ ...discardAllQcFlagsActionState . match ( {
270+ Loading : ( ) => ( {
271+ disabled : true ,
272+ title : 'Loading' ,
273+ } ) ,
274+ Other : ( ) => ( { } ) ,
275+ } ) ,
276+ onclick : ( ) => {
277+ if ( confirm ( 'Are you sure you want to delete ALL the QC flags for this data pass?' ) ) {
278+ perDataPassOverviewModel . discardAllQcFlags ( ) ;
279+ }
280+ } ,
281+ } ,
282+ 'Delete ALL QC flags' ,
235283 ) ,
236- h ( '.mlauto' , qcSummaryLegendTooltip ( ) ) ,
237- h ( '#actions-dropdown-button' , DropdownComponent (
238- h ( 'button.btn.btn-primary' , h ( '.flex-row.g2' , [ 'Actions' , iconCaretBottom ( ) ] ) ) ,
239- h ( '.flex-column.p2.g2' , [
240- exportTriggerAndModal ( perDataPassOverviewModel . exportModel , modalModel , { autoMarginLeft : false } ) ,
241- frontLink (
242- h ( 'button.btn.btn-primary.w-100.h2}#set-qc-flags-trigger' , {
243- disabled : runDetectorsSelectionIsEmpty ,
244- } , 'Set QC Flags' ) ,
245- 'qc-flag-creation-for-data-pass' ,
246- {
247- runNumberDetectorsMap : perDataPassOverviewModel . runDetectorsSelectionModel . selectedQueryString ,
248- dataPassId,
249- } ,
250- ) ,
251- sessionService . hasAccess ( [ BkpRoles . DPG_ASYNC_QC_ADMIN ] ) && [
252- h (
253- 'button.btn.btn-danger' ,
254- {
255- ...freezeOrUnfreezeActionState . match ( {
256- Loading : ( ) => ( {
257- disabled : true ,
258- title : 'Loading' ,
259- } ) ,
260- Other : ( ) => ( { } ) ,
261- } ) ,
262- onclick : ( ) => dataPass . isFrozen
263- ? perDataPassOverviewModel . unfreezeDataPass ( )
264- : perDataPassOverviewModel . freezeDataPass ( ) ,
265- } ,
266- `${ dataPass . isFrozen ? 'Unfreeze' : 'Freeze' } the data pass` ,
267- ) ,
268- h (
269- 'button.btn.btn-danger' ,
270- {
271- ...discardAllQcFlagsActionState . match ( {
272- Loading : ( ) => ( {
273- disabled : true ,
274- title : 'Loading' ,
275- } ) ,
276- Other : ( ) => ( { } ) ,
277- } ) ,
278- onclick : ( ) => {
279- if ( confirm ( 'Are you sure you want to delete ALL the QC flags for this data pass?' ) ) {
280- perDataPassOverviewModel . discardAllQcFlags ( ) ;
281- }
282- } ,
283- } ,
284- 'Delete ALL QC flags' ,
285- ) ,
286- ] ,
287- ] ) ,
288- { alignment : 'right' } ,
289- ) ) ,
290- ] ) ,
284+ ] ,
285+ ] ) ,
286+ { alignment : 'right' } ,
287+ ) ) ,
288+ ] ) ,
289+ h (
290+ '.intermediate-flex-column' ,
291+ { onremove : ( ) => perDataPassOverviewModel . _abortGaqFetches ( ) } ,
292+ mergeRemoteData ( [ remoteRuns ] ) . match ( {
293+ NotAsked : ( ) => null ,
294+ Failure : ( errors ) => errorAlert ( errors ) ,
295+ Success : ( [ runs ] ) => [
291296 markAsSkimmableRequestResult . match ( {
292297 Failure : ( errors ) => errorAlert ( errors ) ,
293298 Other : ( ) => null ,
@@ -311,9 +316,9 @@ export const RunsPerDataPassOverviewPage = ({
311316 { sort : sortModel } ,
312317 ) ,
313318 paginationComponent ( perDataPassOverviewModel . pagination ) ,
314- ] ;
315- } ,
316- Loading : ( ) => spinner ( ) ,
317- } ) ,
318- ) ;
319+ ] ,
320+ Loading : ( ) => spinner ( ) ,
321+ } ) ,
322+ ) ,
323+ ] ;
319324} ;
0 commit comments