Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class FixedPdpBeamTypeRunsOverviewModel extends RunsWithQcModel {
*/
constructor(model) {
super(model);

this._pdpBeamType = null;
}

Expand Down
72 changes: 72 additions & 0 deletions lib/public/views/Runs/Overview/RunsWithQcModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
* or submit itself to any jurisdiction.
*/

import { buildUrl } from '/js/src/index.js';
import { NumericalComparisonFilterModel } from '../../../components/Filters/common/filters/NumericalComparisonFilterModel.js';
import { RunDetectorsSelectionModel } from '../RunDetectorsSelectionModel.js';
import { RunsOverviewModel } from './RunsOverviewModel.js';

/**
Expand All @@ -26,10 +29,79 @@ export class RunsWithQcModel extends RunsOverviewModel {
constructor(model) {
super(model);

this._mcReproducibleAsNotBad = false;

this._runDetectorsSelectionModel = new RunDetectorsSelectionModel();
this._runDetectorsSelectionModel.bubbleTo(this);

this.patchDisplayOptions({
horizontalScrollEnabled: true,
verticalScrollEnabled: true,
freezeFirstColumn: true,
});
}

/**
* @inheritdoc
*/
getRootEndpoint() {
const filter = {};
filter.detectorsQc = {
mcReproducibleAsNotBad: this._mcReproducibleAsNotBad,
};

return buildUrl(super.getRootEndpoint(), { filter });
}

/**
* Set mcReproducibleAsNotBad
*
* @param {boolean} mcReproducibleAsNotBad new value
* @return {void}
*/
setMcReproducibleAsNotBad(mcReproducibleAsNotBad) {
this._mcReproducibleAsNotBad = mcReproducibleAsNotBad;
this.load();
}

/**
* Get mcReproducibleAsNotBad
*
* @return {boolean} mcReproducibleAsNotBad
*/
get mcReproducibleAsNotBad() {
return this._mcReproducibleAsNotBad;
}

/**
* Returns the run detectors selection model
*
* @return {RunDetectorsSelectionModel} selection model
*/
get runDetectorsSelectionModel() {
return this._runDetectorsSelectionModel;
}

/**
* @inheritdoc
*/
async load() {
this._runDetectorsSelectionModel.reset();
super.load();
}

/**
* Register not-bad fraction detectors filtering model
* @param {ObservableData<RemoteData<Detector>>} detectors$ detectors remote data observable
*/
registerDetectorsNotBadFractionFilterModels(detectors$) {
detectors$.observe((observableData) => observableData.getCurrent().apply({
Success: (detectors) => detectors.forEach(({ id }) => {
this._filteringModel.put(`detectorsQc[_${id}][notBadFraction]`, new NumericalComparisonFilterModel({
scale: 0.01,
integer: false,
}));
}),
}));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { jsonPatch } from '../../../utilities/fetch/jsonPatch.js';
import { jsonPut } from '../../../utilities/fetch/jsonPut.js';
import { SkimmingStage } from '../../../domain/enums/SkimmingStage.js';
import { NumericalComparisonFilterModel } from '../../../components/Filters/common/filters/NumericalComparisonFilterModel.js';
import { RunDetectorsSelectionModel } from '../RunDetectorsSelectionModel.js';
import { jsonFetch } from '../../../utilities/fetch/jsonFetch.js';

/**
Expand All @@ -35,23 +34,17 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
super(model);
this._detectors$ = detectorsProvider.qc$;
this._detectors$.bubbleTo(this);
this._detectors$.observe((observableData) => observableData.getCurrent().apply({
Success: (detectors) => detectors.forEach(({ id }) => {
this._filteringModel.put(`detectorsQc[_${id}][notBadFraction]`, new NumericalComparisonFilterModel({
scale: 0.01,
integer: false,
}));
}),
}));
this.registerDetectorsNotBadFractionFilterModels(this._detectors$);

this._dataPass = new ObservableData(RemoteData.notAsked());
this._dataPass.bubbleTo(this);

this._qcSummary$ = new ObservableData(RemoteData.notAsked());
this._qcSummary$.bubbleTo(this);

this._gaqSummary$ = new ObservableData(RemoteData.notAsked());
this._gaqSummary$.bubbleTo(this);

this._mcReproducibleAsNotBad = false;

this._markAsSkimmableRequestResult$ = new ObservableData(RemoteData.notAsked());
this._markAsSkimmableRequestResult$.bubbleTo(this);

Expand All @@ -63,9 +56,6 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
integer: false,
}));

this._runDetectorsSelectionModel = new RunDetectorsSelectionModel();
this._runDetectorsSelectionModel.bubbleTo(this);

this._freezeOrUnfreezeActionState$ = new ObservableData(RemoteData.notAsked());
this._freezeOrUnfreezeActionState$.bubbleTo(this);

Expand Down Expand Up @@ -116,8 +106,6 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
return;
}

this._runDetectorsSelectionModel.reset();

this._fetchQcSummary();
this._fetchGaqSummary();
await this._fetchDataPass();
Expand All @@ -139,9 +127,6 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
mcReproducibleAsNotBad: this._mcReproducibleAsNotBad,
};
}
filter.detectorsQc = {
mcReproducibleAsNotBad: this._mcReproducibleAsNotBad,
};

return buildUrl(super.getRootEndpoint(), { filter });
}
Expand Down Expand Up @@ -314,35 +299,6 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
return this._dataPassId;
}

/**
* Set mcReproducibleAsNotBad
*
* @param {boolean} mcReproducibleAsNotBad new value
* @return {void}
*/
setMcReproducibleAsNotBad(mcReproducibleAsNotBad) {
this._mcReproducibleAsNotBad = mcReproducibleAsNotBad;
this.load();
}

/**
* Get mcReproducibleAsNotBad
*
* @return {boolean} mcReproducibleAsNotBad
*/
get mcReproducibleAsNotBad() {
return this._mcReproducibleAsNotBad;
}

/**
* Returns the run detectors selection model
*
* @return {RunDetectorsSelectionModel} selection model
*/
get runDetectorsSelectionModel() {
return this._runDetectorsSelectionModel;
}

/**
* Fetch data pass data which runs are fetched
* @return {Promise<void>} promise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { mergeRemoteData } from '../../../utilities/mergeRemoteData.js';
import { numericalComparisonFilter } from '../../../components/Filters/common/filters/numericalComparisonFilter.js';
import { iconCaretBottom } from '/js/src/icons.js';
import { BkpRoles } from '../../../domain/enums/BkpRoles.js';
import { mcReproducibleAsNotBadToggle } from '../mcReproducibleAsNotBadToggle.js';

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

/**
* Display a toggle switch to change interpretation of MC.Reproducible flag type from bad to not-bad
*
* @param {boolean} value current value
* @param {function} onChange to be called when switching
* @returns {Component} the toggle switch
*/
const mcReproducibleAsNotBadToggle = (value, onChange) => h('#mcReproducibleAsNotBadToggle', switchInput(
value,
onChange,
{ labelAfter: h('em', 'MC.R as not-bad') },
));

/**
* Render (if applies to type of current data pass) button to mark current data pass as skimmable,
* if it's skimmable already, badge with this information is rendered instead
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { RunsWithQcModel } from '../Overview/RunsWithQcModel.js';
import { ObservableData } from '../../../utilities/ObservableData.js';
import { getRemoteData } from '../../../utilities/fetch/getRemoteData.js';
import { detectorsProvider } from '../../../services/detectors/detectorsProvider.js';
import { RunDetectorsSelectionModel } from '../RunDetectorsSelectionModel.js';

/**
* Runs Per Simulation Pass overview model
Expand All @@ -27,15 +26,16 @@ export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel {
*/
constructor(model) {
super(model);

this._detectors$ = detectorsProvider.qc$;
this._detectors$.bubbleTo(this);
this.registerDetectorsNotBadFractionFilterModels(this._detectors$);

this._simulationPass$ = new ObservableData(RemoteData.notAsked());
this._simulationPass$.bubbleTo(this);

this._qcSummary$ = new ObservableData(RemoteData.NotAsked());
this._qcSummary$.bubbleTo(this);

this._runDetectorsSelectionModel = new RunDetectorsSelectionModel();
this._runDetectorsSelectionModel.bubbleTo(this);
}

/**
Expand All @@ -59,7 +59,10 @@ export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel {
async _fetchQcSummary() {
this._qcSummary$.setCurrent(RemoteData.loading());
try {
const { data: qcSummary } = await getRemoteData(buildUrl('/api/qcFlags/summary', { simulationPassId: this._simulationPassId }));
const { data: qcSummary } = await getRemoteData(buildUrl('/api/qcFlags/summary', {
simulationPassId: this._simulationPassId,
mcReproducibleAsNotBad: this._mcReproducibleAsNotBad,
}));
this._qcSummary$.setCurrent(RemoteData.success(qcSummary));
} catch (error) {
this._qcSummary$.setCurrent(RemoteData.failure(error));
Expand All @@ -70,8 +73,6 @@ export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel {
* @inheritdoc
*/
async load() {
this._runDetectorsSelectionModel.reset();

this._fetchQcSummary();
this._fetchSimulationPass();
super.load();
Expand Down Expand Up @@ -129,13 +130,4 @@ export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel {
get qcSummary() {
return this._qcSummary$.getCurrent();
}

/**
* Returns the run detectors selection model
*
* @return {RunDetectorsSelectionModel} selection model
*/
get runDetectorsSelectionModel() {
return this._runDetectorsSelectionModel;
}
}
Loading