Skip to content

Commit f1810ff

Browse files
committed
use on front
1 parent 6b6b438 commit f1810ff

5 files changed

Lines changed: 70 additions & 82 deletions

File tree

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

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export class RunsWithQcModel extends RunsOverviewModel {
105105
*/
106106
async load() {
107107
this._runDetectorsSelectionModel.reset();
108+
this._fetchQcSummary();
108109
super.load();
109110
}
110111

@@ -130,46 +131,50 @@ export class RunsWithQcModel extends RunsOverviewModel {
130131
throw Error('Method not implemented');
131132
}
132133

134+
/**
135+
* Abstract
136+
*/
137+
get detectors() {
138+
throw Error('Method not implemented');
139+
}
140+
133141
/**
134142
* Fetch QC summaries for given data pass
135143
* @return {Promise<void>} promise
136144
*/
137145
async _fetchQcSummary() {
138-
this._qcSummary$.setCurrent(RemoteData.loading());
139-
try {
140-
const { data: qcSummary1 } = await getRemoteData(buildUrl('/api/qcFlags/summary', {
141-
...this.qcSummaryScope(),
142-
detectorIds: this.detectors.match({
143-
Success: (detectors) => detectors
144-
.filter(({ type }) => type === DetectorType.PHYSICAL)
145-
.map(({ id }) => id).join(','),
146-
Other: () => undefined,
147-
}),
148-
mcReproducibleAsNotBad: this._mcReproducibleAsNotBad,
149-
}));
150-
151-
const { data: qcSummary2 } = await getRemoteData(buildUrl('/api/qcFlags/summary', {
152-
...this.qcSummaryScope(),
153-
detectorIds: this.detectors.match({
154-
Success: (detectors) => detectors
155-
.filter(({ type }) => [DetectorType.AOT_GLO, DetectorType.AOT_EVENT, DetectorType.MUON_GLO].includes(type))
156-
.map(({ id }) => id).join(','),
157-
Other: () => undefined,
158-
}),
159-
filter: {
160-
createdBy: {
161-
names: 'Anonymous',
162-
operator: 'none',
163-
},
164-
},
165-
mcReproducibleAsNotBad: this._mcReproducibleAsNotBad,
166-
}));
167-
console.log(qcSummary1)
168-
console.log(qcSummary2)
169-
this._qcSummary$.setCurrent(RemoteData.success(mergeQcSummaries([qcSummary1, qcSummary2])));
170-
} catch (error) {
171-
this._qcSummary$.setCurrent(RemoteData.failure(error));
172-
}
146+
this.detectors.match({
147+
Success: async (detectors) => {
148+
this._qcSummary$.setCurrent(RemoteData.loading());
149+
try {
150+
const { data: qcSummary1 } = await getRemoteData(buildUrl('/api/qcFlags/summary', {
151+
...this.qcSummaryScope(),
152+
detectorIds: detectors
153+
.filter(({ type }) => type === DetectorType.PHYSICAL)
154+
.map(({ id }) => id).join(','),
155+
mcReproducibleAsNotBad: this._mcReproducibleAsNotBad,
156+
}));
157+
158+
const { data: qcSummary2 } = await getRemoteData(buildUrl('/api/qcFlags/summary', {
159+
...this.qcSummaryScope(),
160+
detectorIds: detectors
161+
.filter(({ type }) => [DetectorType.AOT_GLO, DetectorType.AOT_EVENT, DetectorType.MUON_GLO].includes(type))
162+
.map(({ id }) => id).join(','),
163+
filter: {
164+
createdBy: {
165+
names: 'Anonymous',
166+
operator: 'none',
167+
},
168+
},
169+
mcReproducibleAsNotBad: this._mcReproducibleAsNotBad,
170+
}));
171+
this._qcSummary$.setCurrent(RemoteData.success(mergeQcSummaries([qcSummary1, qcSummary2])));
172+
} catch (error) {
173+
this._qcSummary$.setCurrent(RemoteData.failure(error));
174+
}
175+
},
176+
Other: () => null,
177+
});
173178
}
174179

175180
/**

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
117117
return;
118118
}
119119

120-
this._fetchQcSummary();
121120
this._fetchGaqSummary();
122121
await this._fetchDataPass();
123122
this._dataPass$.getCurrent().match({

lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewModel.js

Lines changed: 29 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class RunsPerLhcPeriodOverviewModel extends RunsWithQcModel {
5252
this._lhcPeriodStatistics$ = new ObservableData(RemoteData.notAsked());
5353
this._lhcPeriodStatistics$.bubbleTo(this);
5454

55-
this._tabbedPanelModel = new RunsPerLhcPeriodTabbedPanelModel();
55+
this._tabbedPanelModel = new RunsPerLhcPeriodTabbedPanelModel(this._qcSummary$);
5656
this._tabbedPanelModel.bubbleTo(this);
5757
}
5858

@@ -78,7 +78,7 @@ export class RunsPerLhcPeriodOverviewModel extends RunsWithQcModel {
7878
return;
7979
}
8080

81-
await this._fetchLhcPeriod();
81+
this._fetchLhcPeriod();
8282
super.load();
8383
}
8484

@@ -102,26 +102,6 @@ export class RunsPerLhcPeriodOverviewModel extends RunsWithQcModel {
102102
return this._lhcPeriodStatistics$.getCurrent();
103103
}
104104

105-
/**
106-
* Set id of current LHC period which runs are fetched
107-
*
108-
* @param {string} lhcPeriodId id of a LHC period
109-
*/
110-
set lhcPeriodId(lhcPeriodId) {
111-
this._lhcPeriodId = lhcPeriodId;
112-
this._tabbedPanelModel.lhcPeriodId = lhcPeriodId;
113-
}
114-
115-
/**
116-
* Set mcReproducibleAsNotBad flag
117-
*
118-
* @param {boolean} mcReproducibleAsNotBad new value
119-
*/
120-
setMcReproducibleAsNotBad(mcReproducibleAsNotBad) {
121-
super.setMcReproducibleAsNotBad(mcReproducibleAsNotBad);
122-
this._tabbedPanelModel.mcReproducibleAsNotBad = mcReproducibleAsNotBad;
123-
}
124-
125105
/**
126106
* Get all detectors
127107
*
@@ -140,6 +120,13 @@ export class RunsPerLhcPeriodOverviewModel extends RunsWithQcModel {
140120
return this._syncDetectors$.getCurrent();
141121
}
142122

123+
/**
124+
* @inheritdoc
125+
*/
126+
get detectors() {
127+
return this._syncDetectors$.getCurrent();
128+
}
129+
143130
/**
144131
* Returns the model for the tabbed component
145132
*
@@ -148,6 +135,22 @@ export class RunsPerLhcPeriodOverviewModel extends RunsWithQcModel {
148135
get tabbedPanelModel() {
149136
return this._tabbedPanelModel;
150137
}
138+
139+
/**
140+
* Set id of current LHC period which runs are fetched
141+
*
142+
* @param {string} lhcPeriodId id of a LHC period
143+
*/
144+
set lhcPeriodId(lhcPeriodId) {
145+
this._lhcPeriodId = lhcPeriodId;
146+
}
147+
148+
/**
149+
* @inheritdoc
150+
*/
151+
qcSummaryScope() {
152+
return { lhcPeriodId: this._lhcPeriodId };
153+
}
151154
}
152155

153156
/**
@@ -156,9 +159,11 @@ export class RunsPerLhcPeriodOverviewModel extends RunsWithQcModel {
156159
class RunsPerLhcPeriodTabbedPanelModel extends TabbedPanelModel {
157160
/**
158161
* Constructor
162+
* @param {ObservableData<RemoteData<QcSummary>>} qcSummary$ obervalbe data of remote data of QC summary
159163
*/
160-
constructor() {
164+
constructor(qcSummary$) {
161165
super(Object.values(RUNS_PER_LHC_PERIOD_PANELS_KEYS));
166+
this._qcSummary$ = qcSummary$;
162167
}
163168

164169
/**
@@ -170,28 +175,8 @@ class RunsPerLhcPeriodTabbedPanelModel extends TabbedPanelModel {
170175
this.currentPanelData = null;
171176
break;
172177
case RUNS_PER_LHC_PERIOD_PANELS_KEYS.SYNCHRONOUS_FLAGS:
173-
// this._fetchSynchronousQcSummary();
178+
this.currentPanelData = this._qcSummary$.getCurrent();
174179
break;
175180
}
176181
}
177-
178-
/**
179-
* Set LHC period id
180-
*
181-
* @param {id} lhcPeriodId id of LHC period
182-
*/
183-
set lhcPeriodId(lhcPeriodId) {
184-
this._lhcPeriodId = lhcPeriodId;
185-
// this._fetchCurrentPanelData();
186-
}
187-
188-
/**
189-
* Set mcReproducibleAsNotBad flag
190-
*
191-
* @param {boolean} mcReproducibleAsNotBad new value
192-
*/
193-
set mcReproducibleAsNotBad(mcReproducibleAsNotBad) {
194-
this._mcReproducibleAsNotBad = mcReproducibleAsNotBad;
195-
// this._fetchCurrentPanelData();
196-
}
197182
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel {
5353
* @inheritdoc
5454
*/
5555
async load() {
56-
this._fetchQcSummary();
5756
this._fetchSimulationPass();
5857
super.load();
5958
}

lib/server/controllers/qcFlag.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ const getQcFlagsSummaryHandler = async (req, res) => {
340340
} = validatedDTO.query;
341341

342342
const data = await qcFlagSummaryService.getSummary(
343-
{ dataPassId, simulationPassId, lhcPeriodId, detectorIds },
343+
{ dataPassId, simulationPassId, lhcPeriodId, dplDetectorIds: detectorIds },
344344
{ mcReproducibleAsNotBad },
345345
filter,
346346
);

0 commit comments

Comments
 (0)