Skip to content

Commit bc988b7

Browse files
authored
[O2B-1173] Remove TST detector from RCT views (#1427)
* docs * update tests * revoke * filter in model * add * refactor * docs * cleanup
1 parent 7db349f commit bc988b7

5 files changed

Lines changed: 19 additions & 6 deletions

File tree

lib/public/services/detectors/detectorsProvider.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import { Observable } from '/js/src/index.js';
1515
import { getRemoteData } from '../../utilities/fetch/getRemoteData.js';
1616

17+
const TST_DETECTOR_NAME = 'TST';
18+
1719
/**
1820
* Service class to fetch detectors from the backend
1921
*/
@@ -39,6 +41,17 @@ export class DetectorsProvider extends Observable {
3941

4042
return this._allDetectors;
4143
}
44+
45+
/**
46+
* Returns the list of all the physical available detectors
47+
* E.g `TST` detector is not phsycial system so it is no included in the results
48+
*
49+
* @return {Promise<Detector[]>} the list of all physcial detectors
50+
*/
51+
async getPhysical() {
52+
await this.getAll();
53+
return this._allDetectors.filter(({ name }) => name !== TST_DETECTOR_NAME);
54+
}
4255
}
4356

4457
export const detectorsProvider = new DetectorsProvider();

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ export class RunsPerDataPassOverviewModel extends RunsOverviewModel {
3434
}
3535

3636
/**
37-
* Retrieve a list of detector types from detectorsProvider
37+
* Retrieve a list of physcial detector from detectorsProvider
3838
*
3939
* @return {Promise<void>} resolves once the data has been fetched
4040
* @private
4141
*/
4242
async _fetchDetectors() {
4343
this._detectors.setCurrent(RemoteData.loading());
4444
try {
45-
this._detectors.setCurrent(RemoteData.success(await detectorsProvider.getAll()));
45+
const detectors = await detectorsProvider.getPhysical();
46+
this._detectors.setCurrent(RemoteData.success(detectors));
4647
} catch (error) {
4748
this._detectors.setCurrent(RemoteData.failure(error));
4849
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,16 @@ export class RunsPerLhcPeriodOverviewModel extends RunsOverviewModel {
3131
}
3232

3333
/**
34-
* Retrieve a list of detector types from detectorsProvider
34+
* Retrieve a list of physcial detector from detectorsProvider
3535
*
3636
* @return {Promise<void>} resolves once the data has been fetched
3737
* @private
3838
*/
3939
async _fetchDetectors() {
4040
this._detectors.setCurrent(RemoteData.loading());
4141
try {
42-
this._detectors.setCurrent(RemoteData.success(await detectorsProvider.getAll()));
42+
const detectors = await detectorsProvider.getPhysical();
43+
this._detectors.setCurrent(RemoteData.success(detectors));
4344
} catch (error) {
4445
this._detectors.setCurrent(RemoteData.failure(error));
4546
}

test/public/runs/runsPerDataPass.overview.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ const DETECTORS = [
4444
'TOF',
4545
'TPC',
4646
'TRD',
47-
'TST',
4847
'ZDC',
4948
];
5049

test/public/runs/runsPerPeriod.overview.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const DETECTORS = [
4141
'TOF',
4242
'TPC',
4343
'TRD',
44-
'TST',
4544
'ZDC',
4645
];
4746

0 commit comments

Comments
 (0)