-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into mboulais/O2B-1204/improvements-for-on-call-t…
…emplate
- Loading branch information
Showing
36 changed files
with
1,238 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/** | ||
* @license | ||
* Copyright CERN and copyright holders of ALICE O2. This software is | ||
* distributed under the terms of the GNU General Public License v3 (GPL | ||
* Version 3), copied verbatim in the file "COPYING". | ||
* | ||
* See http://alice-o2.web.cern.ch/license for full licensing information. | ||
* | ||
* In applying this license CERN does not waive the privileges and immunities | ||
* granted to it by virtue of its status as an Intergovernmental Organization | ||
* or submit itself to any jurisdiction. | ||
*/ | ||
|
||
import { Observable, RemoteData } from '/js/src/index.js'; | ||
import { getRemoteData } from '../../utilities/fetch/getRemoteData.js'; | ||
import { ObservableData } from '../../utilities/ObservableData.js'; | ||
|
||
const TST_DETECTOR_NAME = 'TST'; | ||
|
||
/** | ||
* Service class to fetch DPL detectors from the backend | ||
*/ | ||
export class DplDetectorsProvider extends Observable { | ||
/** | ||
* Constructor | ||
*/ | ||
constructor() { | ||
super(); | ||
this._all$ = new ObservableData(RemoteData.notAsked()); | ||
this._physical$ = ObservableData.builder() | ||
.source(this._all$) | ||
.apply((remoteDetectors) => remoteDetectors.apply({ | ||
Success: (detectors) => detectors.filter(({ name }) => name && name !== TST_DETECTOR_NAME), | ||
})) | ||
.build(); | ||
} | ||
|
||
/** | ||
* Return all DPL detectors observable data | ||
* | ||
* @return {ObservableData<RemoteData<DplDetector[], ApiError>>} the observable DPL detectors list | ||
*/ | ||
get all$() { | ||
if (this._isStale()) { | ||
this._load(); | ||
} | ||
return this._all$; | ||
} | ||
|
||
/** | ||
* Return physical (meaning actual detectors, for example excluding TST) DPL detectors list observable data | ||
* | ||
* @return {ObservableData<RemoteData<Detector[], ApiError>>} the observable physical DPL detectors list | ||
*/ | ||
get physical$() { | ||
if (this._isStale()) { | ||
this._load(); | ||
} | ||
return this._physical$; | ||
} | ||
|
||
/** | ||
* States if the cached detectors list need to be created or updated | ||
* | ||
* @return {boolean} true if the detectors list must be refreshed | ||
* @private | ||
*/ | ||
_isStale() { | ||
return this._all$.getCurrent().match({ | ||
NotAsked: () => true, | ||
Other: () => false, | ||
}); | ||
} | ||
|
||
/** | ||
* Load all the detectors and feed the observable data | ||
* | ||
* @return {void} | ||
* @private | ||
*/ | ||
_load() { | ||
this._all$.setCurrent(RemoteData.loading()); | ||
getRemoteData('/api/dpl-detectors').then( | ||
({ data: detectors }) => this._all$.setCurrent(RemoteData.success(detectors)), | ||
(error) => this._all$.setCurrent(RemoteData.failure(error)), | ||
); | ||
} | ||
} | ||
|
||
export const dplDetectorsProvider = new DplDetectorsProvider(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
lib/public/views/QcFlags/ActiveColumns/qcFlagsActiveColumns.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* @license | ||
* Copyright CERN and copyright holders of ALICE O2. This software is | ||
* distributed under the terms of the GNU General Public License v3 (GPL | ||
* Version 3), copied verbatim in the file "COPYING". | ||
* | ||
* See http://alice-o2.web.cern.ch/license for full licensing information. | ||
* | ||
* In applying this license CERN does not waive the privileges and immunities | ||
* granted to it by virtue of its status as an Intergovernmental Organization | ||
* or submit itself to any jurisdiction. | ||
*/ | ||
|
||
import { h } from '/js/src/index.js'; | ||
import { formatTimestamp } from '../../../utilities/formatting/formatTimestamp.js'; | ||
import { qcFlagTypeColoredBadge } from '../common/qcFlagTypeColoredBadge.js'; | ||
|
||
/** | ||
* Active columns configuration for QC flags table | ||
*/ | ||
export const qcFlagsActiveColumns = { | ||
id: { | ||
name: 'Id', | ||
visible: false, | ||
}, | ||
|
||
flagType: { | ||
name: 'Type', | ||
visible: true, | ||
format: (flagType) => h('.flex-row.g1', [flagType.name, qcFlagTypeColoredBadge(flagType)]), | ||
}, | ||
|
||
from: { | ||
name: 'From', | ||
visible: true, | ||
format: (timestamp) => timestamp | ||
? formatTimestamp(timestamp, false) | ||
: 'Whole run coverage', | ||
}, | ||
|
||
to: { | ||
name: 'To', | ||
visible: true, | ||
format: (timestamp) => timestamp | ||
? formatTimestamp(timestamp, false) | ||
: 'Whole run coverage', | ||
}, | ||
|
||
comment: { | ||
name: 'Comment', | ||
visible: true, | ||
}, | ||
|
||
createdBy: { | ||
name: 'Created by', | ||
visible: true, | ||
format: (createdBy) => createdBy?.name || '-', | ||
}, | ||
|
||
createdAt: { | ||
name: 'Created at', | ||
visible: true, | ||
format: (timestamp) => formatTimestamp(timestamp, false), | ||
}, | ||
|
||
updatedAt: { | ||
name: 'Updated at', | ||
visible: true, | ||
format: (timestamp) => formatTimestamp(timestamp, false), | ||
}, | ||
}; |
86 changes: 86 additions & 0 deletions
86
lib/public/views/QcFlags/ForDataPass/QcFlagsForDataPassOverviewModel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/** | ||
* @license | ||
* Copyright CERN and copyright holders of ALICE O2. This software is | ||
* distributed under the terms of the GNU General Public License v3 (GPL | ||
* Version 3), copied verbatim in the file "COPYING". | ||
* | ||
* See http://alice-o2.web.cern.ch/license for full licensing information. | ||
* | ||
* In applying this license CERN does not waive the privileges and immunities | ||
* granted to it by virtue of its status as an Intergovernmental Organization | ||
* or submit itself to any jurisdiction. | ||
*/ | ||
|
||
import { buildUrl } from '../../../utilities/fetch/buildUrl.js'; | ||
import { RemoteData } from '/js/src/index.js'; | ||
import { getRemoteData } from '../../../utilities/fetch/getRemoteData.js'; | ||
import { QcFlagsOverviewModel } from '../Overview/QcFlagsOverviewModel.js'; | ||
import { ObservableData } from '../../../utilities/ObservableData.js'; | ||
|
||
/** | ||
* Quality Control Flags for data pass overview model | ||
* | ||
* @implements {OverviewModel} | ||
*/ | ||
export class QcFlagsForDataPassOverviewModel extends QcFlagsOverviewModel { | ||
/** | ||
* The constructor of the Overview model object | ||
*/ | ||
constructor() { | ||
super(); | ||
this._dataPass$ = new ObservableData(RemoteData.notAsked()); | ||
this._dataPass$.bubbleTo(this); | ||
} | ||
|
||
// eslint-disable-next-line valid-jsdoc | ||
/** | ||
* @inheritdoc | ||
*/ | ||
getRootEndpoint() { | ||
const params = { | ||
filter: { | ||
dataPassIds: [this._dataPassId], | ||
}, | ||
}; | ||
return buildUrl(super.getRootEndpoint(), params); | ||
} | ||
|
||
// eslint-disable-next-line valid-jsdoc | ||
/** | ||
* @inheritdoc | ||
*/ | ||
load() { | ||
this._fetchDataPass(); | ||
super.load(); | ||
} | ||
|
||
/** | ||
* Fetch data pass data which QC glags are fetched | ||
* @return {Promise<void>} promise | ||
*/ | ||
async _fetchDataPass() { | ||
this._dataPass$.setCurrent(RemoteData.loading()); | ||
try { | ||
const { data: [dataPass] } = await getRemoteData(`/api/dataPasses/?filter[ids][]=${this._dataPassId}`); | ||
this._dataPass$.setCurrent(RemoteData.success(dataPass)); | ||
} catch (error) { | ||
this._dataPass$.setCurrent(RemoteData.failure(error)); | ||
} | ||
} | ||
|
||
/** | ||
* Set id of data pass which for QC flags should be fetched | ||
* @param {number} dataPassId data pass id | ||
*/ | ||
set dataPassId(dataPassId) { | ||
this._dataPassId = dataPassId; | ||
} | ||
|
||
/** | ||
* Get current data pass which QC flags are fetched | ||
* @return {RemoteData<SimulationPass>} data pass remote data | ||
*/ | ||
get dataPass() { | ||
return this._dataPass$.getCurrent(); | ||
} | ||
} |
Oops, something went wrong.