Skip to content

Commit 7fe7219

Browse files
committed
refactor
1 parent acadb46 commit 7fe7219

4 files changed

Lines changed: 46 additions & 53 deletions

File tree

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*/
1313

1414
import { NumericalComparisonFilterModel } from '../../../components/Filters/common/filters/NumericalComparisonFilterModel.js';
15+
import { RunDetectorsSelectionModel } from '../RunDetectorsSelectionModel.js';
1516
import { RunsOverviewModel } from './RunsOverviewModel.js';
1617

1718
/**
@@ -27,13 +28,55 @@ export class RunsWithQcModel extends RunsOverviewModel {
2728
constructor(model) {
2829
super(model);
2930

31+
this._mcReproducibleAsNotBad = false;
32+
33+
this._runDetectorsSelectionModel = new RunDetectorsSelectionModel();
34+
this._runDetectorsSelectionModel.bubbleTo(this);
35+
3036
this.patchDisplayOptions({
3137
horizontalScrollEnabled: true,
3238
verticalScrollEnabled: true,
3339
freezeFirstColumn: true,
3440
});
3541
}
3642

43+
/**
44+
* Set mcReproducibleAsNotBad
45+
*
46+
* @param {boolean} mcReproducibleAsNotBad new value
47+
* @return {void}
48+
*/
49+
setMcReproducibleAsNotBad(mcReproducibleAsNotBad) {
50+
this._mcReproducibleAsNotBad = mcReproducibleAsNotBad;
51+
this.load();
52+
}
53+
54+
/**
55+
* Get mcReproducibleAsNotBad
56+
*
57+
* @return {boolean} mcReproducibleAsNotBad
58+
*/
59+
get mcReproducibleAsNotBad() {
60+
return this._mcReproducibleAsNotBad;
61+
}
62+
63+
/**
64+
* Returns the run detectors selection model
65+
*
66+
* @return {RunDetectorsSelectionModel} selection model
67+
*/
68+
get runDetectorsSelectionModel() {
69+
return this._runDetectorsSelectionModel;
70+
}
71+
72+
/**
73+
* @inheritdoc
74+
*/
75+
async load() {
76+
this._runDetectorsSelectionModel.reset();
77+
super.load();
78+
}
79+
3780
/**
3881
* Register not-bad fraction detectors filtering model
3982
* @param {ObservableData<RemoteData<Detector>>} detectors$ detectors remote data observable

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

Lines changed: 0 additions & 37 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
/**
@@ -44,8 +43,6 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
4443
this._gaqSummary$ = new ObservableData(RemoteData.notAsked());
4544
this._gaqSummary$.bubbleTo(this);
4645

47-
this._mcReproducibleAsNotBad = false;
48-
4946
this._markAsSkimmableRequestResult$ = new ObservableData(RemoteData.notAsked());
5047
this._markAsSkimmableRequestResult$.bubbleTo(this);
5148

@@ -57,9 +54,6 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
5754
integer: false,
5855
}));
5956

60-
this._runDetectorsSelectionModel = new RunDetectorsSelectionModel();
61-
this._runDetectorsSelectionModel.bubbleTo(this);
62-
6357
this._freezeOrUnfreezeActionState$ = new ObservableData(RemoteData.notAsked());
6458
this._freezeOrUnfreezeActionState$.bubbleTo(this);
6559

@@ -110,8 +104,6 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
110104
return;
111105
}
112106

113-
this._runDetectorsSelectionModel.reset();
114-
115107
this._fetchQcSummary();
116108
this._fetchGaqSummary();
117109
await this._fetchDataPass();
@@ -308,35 +300,6 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
308300
return this._dataPassId;
309301
}
310302

311-
/**
312-
* Set mcReproducibleAsNotBad
313-
*
314-
* @param {boolean} mcReproducibleAsNotBad new value
315-
* @return {void}
316-
*/
317-
setMcReproducibleAsNotBad(mcReproducibleAsNotBad) {
318-
this._mcReproducibleAsNotBad = mcReproducibleAsNotBad;
319-
this.load();
320-
}
321-
322-
/**
323-
* Get mcReproducibleAsNotBad
324-
*
325-
* @return {boolean} mcReproducibleAsNotBad
326-
*/
327-
get mcReproducibleAsNotBad() {
328-
return this._mcReproducibleAsNotBad;
329-
}
330-
331-
/**
332-
* Returns the run detectors selection model
333-
*
334-
* @return {RunDetectorsSelectionModel} selection model
335-
*/
336-
get runDetectorsSelectionModel() {
337-
return this._runDetectorsSelectionModel;
338-
}
339-
340303
/**
341304
* Fetch data pass data which runs are fetched
342305
* @return {Promise<void>} promise

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

Lines changed: 2 additions & 15 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
@@ -29,13 +28,12 @@ export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel {
2928
super(model);
3029
this._detectors$ = detectorsProvider.qc$;
3130
this._detectors$.bubbleTo(this);
31+
this.registerDetectorsNotBadFractionFilterModels(this._detectors$);
32+
3233
this._simulationPass$ = new ObservableData(RemoteData.notAsked());
3334
this._simulationPass$.bubbleTo(this);
3435
this._qcSummary$ = new ObservableData(RemoteData.NotAsked());
3536
this._qcSummary$.bubbleTo(this);
36-
37-
this._runDetectorsSelectionModel = new RunDetectorsSelectionModel();
38-
this._runDetectorsSelectionModel.bubbleTo(this);
3937
}
4038

4139
/**
@@ -70,8 +68,6 @@ export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel {
7068
* @inheritdoc
7169
*/
7270
async load() {
73-
this._runDetectorsSelectionModel.reset();
74-
7571
this._fetchQcSummary();
7672
this._fetchSimulationPass();
7773
super.load();
@@ -129,13 +125,4 @@ export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel {
129125
get qcSummary() {
130126
return this._qcSummary$.getCurrent();
131127
}
132-
133-
/**
134-
* Returns the run detectors selection model
135-
*
136-
* @return {RunDetectorsSelectionModel} selection model
137-
*/
138-
get runDetectorsSelectionModel() {
139-
return this._runDetectorsSelectionModel;
140-
}
141128
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export const RunsPerSimulationPassOverviewPage = ({
9292

9393
return [
9494
h('.flex-row.justify-between.items-center.g2', [
95-
filtersPanelPopover(perSimulationPassOverviewModel.filteringModel, activeColumns, { profile: 'runsPerSimulationPass' }),
95+
filtersPanelPopover(perSimulationPassOverviewModel, activeColumns, { profile: 'runsPerSimulationPass' }),
9696
h('.pl2#runOverviewFilter', runNumbersFilter(perSimulationPassOverviewModel.filteringModel.get('runNumbers'))),
9797
h(
9898
'.flex-row.g1.items-center',

0 commit comments

Comments
 (0)