Skip to content

Commit c9865b0

Browse files
committed
Resolve merge conflicts
2 parents b6b5d80 + 3261434 commit c9865b0

15 files changed

Lines changed: 263 additions & 157 deletions

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export class FixedPdpBeamTypeRunsOverviewModel extends RunsWithQcModel {
2626
*/
2727
constructor(model) {
2828
super(model);
29+
2930
this._pdpBeamType = null;
3031
}
3132

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

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

14+
import { buildUrl } from '/js/src/index.js';
15+
import { NumericalComparisonFilterModel } from '../../../components/Filters/common/filters/NumericalComparisonFilterModel.js';
16+
import { RunDetectorsSelectionModel } from '../RunDetectorsSelectionModel.js';
1417
import { RunsOverviewModel } from './RunsOverviewModel.js';
1518

1619
/**
@@ -26,10 +29,79 @@ export class RunsWithQcModel extends RunsOverviewModel {
2629
constructor(model) {
2730
super(model);
2831

32+
this._mcReproducibleAsNotBad = false;
33+
34+
this._runDetectorsSelectionModel = new RunDetectorsSelectionModel();
35+
this._runDetectorsSelectionModel.bubbleTo(this);
36+
2937
this.patchDisplayOptions({
3038
horizontalScrollEnabled: true,
3139
verticalScrollEnabled: true,
3240
freezeFirstColumn: true,
3341
});
3442
}
43+
44+
/**
45+
* @inheritdoc
46+
*/
47+
getRootEndpoint() {
48+
const filter = {};
49+
filter.detectorsQc = {
50+
mcReproducibleAsNotBad: this._mcReproducibleAsNotBad,
51+
};
52+
53+
return buildUrl(super.getRootEndpoint(), { filter });
54+
}
55+
56+
/**
57+
* Set mcReproducibleAsNotBad
58+
*
59+
* @param {boolean} mcReproducibleAsNotBad new value
60+
* @return {void}
61+
*/
62+
setMcReproducibleAsNotBad(mcReproducibleAsNotBad) {
63+
this._mcReproducibleAsNotBad = mcReproducibleAsNotBad;
64+
this.load();
65+
}
66+
67+
/**
68+
* Get mcReproducibleAsNotBad
69+
*
70+
* @return {boolean} mcReproducibleAsNotBad
71+
*/
72+
get mcReproducibleAsNotBad() {
73+
return this._mcReproducibleAsNotBad;
74+
}
75+
76+
/**
77+
* Returns the run detectors selection model
78+
*
79+
* @return {RunDetectorsSelectionModel} selection model
80+
*/
81+
get runDetectorsSelectionModel() {
82+
return this._runDetectorsSelectionModel;
83+
}
84+
85+
/**
86+
* @inheritdoc
87+
*/
88+
async load() {
89+
this._runDetectorsSelectionModel.reset();
90+
super.load();
91+
}
92+
93+
/**
94+
* Register not-bad fraction detectors filtering model
95+
* @param {ObservableData<RemoteData<Detector>>} detectors$ detectors remote data observable
96+
*/
97+
registerDetectorsNotBadFractionFilterModels(detectors$) {
98+
detectors$.observe((observableData) => observableData.getCurrent().apply({
99+
Success: (detectors) => detectors.forEach(({ id }) => {
100+
this._filteringModel.put(`detectorsQc[_${id}][notBadFraction]`, new NumericalComparisonFilterModel({
101+
scale: 0.01,
102+
integer: false,
103+
}));
104+
}),
105+
}));
106+
}
35107
}

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

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { jsonPatch } from '../../../utilities/fetch/jsonPatch.js';
2020
import { jsonPut } from '../../../utilities/fetch/jsonPut.js';
2121
import { SkimmingStage } from '../../../domain/enums/SkimmingStage.js';
2222
import { NumericalComparisonFilterModel } from '../../../components/Filters/common/filters/NumericalComparisonFilterModel.js';
23-
import { RunDetectorsSelectionModel } from '../RunDetectorsSelectionModel.js';
2423
import { jsonFetch } from '../../../utilities/fetch/jsonFetch.js';
2524

2625
/**
@@ -35,23 +34,17 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
3534
super(model);
3635
this._detectors$ = detectorsProvider.qc$;
3736
this._detectors$.bubbleTo(this);
38-
this._detectors$.observe((observableData) => observableData.getCurrent().apply({
39-
Success: (detectors) => detectors.forEach(({ id }) => {
40-
this._filteringModel.put(`detectorsQc[_${id}][notBadFraction]`, new NumericalComparisonFilterModel({
41-
scale: 0.01,
42-
integer: false,
43-
}));
44-
}),
45-
}));
37+
this.registerDetectorsNotBadFractionFilterModels(this._detectors$);
38+
4639
this._dataPass = new ObservableData(RemoteData.notAsked());
4740
this._dataPass.bubbleTo(this);
41+
4842
this._qcSummary$ = new ObservableData(RemoteData.notAsked());
4943
this._qcSummary$.bubbleTo(this);
44+
5045
this._gaqSummary$ = new ObservableData(RemoteData.notAsked());
5146
this._gaqSummary$.bubbleTo(this);
5247

53-
this._mcReproducibleAsNotBad = false;
54-
5548
this._markAsSkimmableRequestResult$ = new ObservableData(RemoteData.notAsked());
5649
this._markAsSkimmableRequestResult$.bubbleTo(this);
5750

@@ -63,9 +56,6 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
6356
integer: false,
6457
}));
6558

66-
this._runDetectorsSelectionModel = new RunDetectorsSelectionModel();
67-
this._runDetectorsSelectionModel.bubbleTo(this);
68-
6959
this._freezeOrUnfreezeActionState$ = new ObservableData(RemoteData.notAsked());
7060
this._freezeOrUnfreezeActionState$.bubbleTo(this);
7161

@@ -116,8 +106,6 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
116106
return;
117107
}
118108

119-
this._runDetectorsSelectionModel.reset();
120-
121109
this._fetchQcSummary();
122110
this._fetchGaqSummary();
123111
await this._fetchDataPass();
@@ -139,9 +127,6 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
139127
mcReproducibleAsNotBad: this._mcReproducibleAsNotBad,
140128
};
141129
}
142-
filter.detectorsQc = {
143-
mcReproducibleAsNotBad: this._mcReproducibleAsNotBad,
144-
};
145130

146131
return buildUrl(super.getRootEndpoint(), { filter });
147132
}
@@ -314,35 +299,6 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
314299
return this._dataPassId;
315300
}
316301

317-
/**
318-
* Set mcReproducibleAsNotBad
319-
*
320-
* @param {boolean} mcReproducibleAsNotBad new value
321-
* @return {void}
322-
*/
323-
setMcReproducibleAsNotBad(mcReproducibleAsNotBad) {
324-
this._mcReproducibleAsNotBad = mcReproducibleAsNotBad;
325-
this.load();
326-
}
327-
328-
/**
329-
* Get mcReproducibleAsNotBad
330-
*
331-
* @return {boolean} mcReproducibleAsNotBad
332-
*/
333-
get mcReproducibleAsNotBad() {
334-
return this._mcReproducibleAsNotBad;
335-
}
336-
337-
/**
338-
* Returns the run detectors selection model
339-
*
340-
* @return {RunDetectorsSelectionModel} selection model
341-
*/
342-
get runDetectorsSelectionModel() {
343-
return this._runDetectorsSelectionModel;
344-
}
345-
346302
/**
347303
* Fetch data pass data which runs are fetched
348304
* @return {Promise<void>} promise

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { mergeRemoteData } from '../../../utilities/mergeRemoteData.js';
3939
import { numericalComparisonFilter } from '../../../components/Filters/common/filters/numericalComparisonFilter.js';
4040
import { iconCaretBottom } from '/js/src/icons.js';
4141
import { BkpRoles } from '../../../domain/enums/BkpRoles.js';
42+
import { mcReproducibleAsNotBadToggle } from '../mcReproducibleAsNotBadToggle.js';
4243

4344
const TABLEROW_HEIGHT = 59;
4445
// Estimate of the navbar and pagination elements height total; Needs to be updated in case of changes;
@@ -52,19 +53,6 @@ const PAGE_USED_HEIGHT = 215;
5253
*/
5354
const getRowClasses = (run) => isRunNotSubjectToQc(run) ? '.danger' : null;
5455

55-
/**
56-
* Display a toggle switch to change interpretation of MC.Reproducible flag type from bad to not-bad
57-
*
58-
* @param {boolean} value current value
59-
* @param {function} onChange to be called when switching
60-
* @returns {Component} the toggle switch
61-
*/
62-
const mcReproducibleAsNotBadToggle = (value, onChange) => h('#mcReproducibleAsNotBadToggle', switchInput(
63-
value,
64-
onChange,
65-
{ labelAfter: h('em', 'MC.R as not-bad') },
66-
));
67-
6856
/**
6957
* Render (if applies to type of current data pass) button to mark current data pass as skimmable,
7058
* if it's skimmable already, badge with this information is rendered instead

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

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { RunsWithQcModel } from '../Overview/RunsWithQcModel.js';
1515
import { ObservableData } from '../../../utilities/ObservableData.js';
1616
import { getRemoteData } from '../../../utilities/fetch/getRemoteData.js';
1717
import { detectorsProvider } from '../../../services/detectors/detectorsProvider.js';
18-
import { RunDetectorsSelectionModel } from '../RunDetectorsSelectionModel.js';
1918

2019
/**
2120
* Runs Per Simulation Pass overview model
@@ -27,15 +26,16 @@ export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel {
2726
*/
2827
constructor(model) {
2928
super(model);
29+
3030
this._detectors$ = detectorsProvider.qc$;
3131
this._detectors$.bubbleTo(this);
32+
this.registerDetectorsNotBadFractionFilterModels(this._detectors$);
33+
3234
this._simulationPass$ = new ObservableData(RemoteData.notAsked());
3335
this._simulationPass$.bubbleTo(this);
36+
3437
this._qcSummary$ = new ObservableData(RemoteData.NotAsked());
3538
this._qcSummary$.bubbleTo(this);
36-
37-
this._runDetectorsSelectionModel = new RunDetectorsSelectionModel();
38-
this._runDetectorsSelectionModel.bubbleTo(this);
3939
}
4040

4141
/**
@@ -59,7 +59,10 @@ export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel {
5959
async _fetchQcSummary() {
6060
this._qcSummary$.setCurrent(RemoteData.loading());
6161
try {
62-
const { data: qcSummary } = await getRemoteData(buildUrl('/api/qcFlags/summary', { simulationPassId: this._simulationPassId }));
62+
const { data: qcSummary } = await getRemoteData(buildUrl('/api/qcFlags/summary', {
63+
simulationPassId: this._simulationPassId,
64+
mcReproducibleAsNotBad: this._mcReproducibleAsNotBad,
65+
}));
6366
this._qcSummary$.setCurrent(RemoteData.success(qcSummary));
6467
} catch (error) {
6568
this._qcSummary$.setCurrent(RemoteData.failure(error));
@@ -70,8 +73,6 @@ export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel {
7073
* @inheritdoc
7174
*/
7275
async load() {
73-
this._runDetectorsSelectionModel.reset();
74-
7576
this._fetchQcSummary();
7677
this._fetchSimulationPass();
7778
super.load();
@@ -129,13 +130,4 @@ export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel {
129130
get qcSummary() {
130131
return this._qcSummary$.getCurrent();
131132
}
132-
133-
/**
134-
* Returns the run detectors selection model
135-
*
136-
* @return {RunDetectorsSelectionModel} selection model
137-
*/
138-
get runDetectorsSelectionModel() {
139-
return this._runDetectorsSelectionModel;
140-
}
141133
}

0 commit comments

Comments
 (0)