-
Notifications
You must be signed in to change notification settings - Fork 21
[O2B-1505] LHCfills beam duration filter #2035
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Houwie7000
wants to merge
45
commits into
main
Choose a base branch
from
feature/O2B-1505/lhcfills-beam-duration-filter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
057c235
[O2B-1502] Filter model setup boilerplate code.
Houwie7000 a7a9eda
[O2B-1502] Add filter button on LHC-fills overview page.
Houwie7000 2648f1c
[O2B-1502] Added stable beams only to filter
Houwie7000 094e6c5
[O2B-1502] Filtering with Stable Beams Only works, radioButton elemen…
Houwie7000 da7ff37
[O2B-1502] Doc fixes
Houwie7000 ee72512
[O2B-1502] Increase timeout of detailsForSimulationPass test. Local m…
Houwie7000 96a04c0
[O2B-1502] Potential fix for test failure.
Houwie7000 6fa4034
Revert "[O2B-1502] Potential fix for test failure."
Houwie7000 17ea048
Merge branch 'main' into feature/O2B-1502/filtering-panel-lhc-fills-f…
graduta 695622b
[O2B-1502] Processed feedback
Houwie7000 87bee89
[O2B-1502] Git failed to detect rename. Ran: git mv RadioButton.js ra…
Houwie7000 5a18d9e
[O2B-1502] Added test import
Houwie7000 4c530ef
Revert "[O2B-1502] Processed feedback"
Houwie7000 51b50d9
[O2B-1502] Cherry pick previous feedback changes
Houwie7000 c0c8559
[O2B-1502] Integrated stable beam only filter into filtermodel.
Houwie7000 9934e56
[O2B-1502] fixed stable beam default value
Houwie7000 f247a6f
[O2B-1502] Fixed logic and type
Houwie7000 9b67281
[O2B-1502] Don't set any defaults in the filter as it will conflict w…
Houwie7000 ea0880f
[O2B-1502] Code cleanup
Houwie7000 46d4ae8
[O2B-1502] minor changes, processed feedback
Houwie7000 91e350c
[O2B-1502] Removed duplicate function due to override
Houwie7000 e95c847
[O2B-1503] Added front end fill number filter
Houwie7000 5077fec
[O2B-1503] fillNumbers work, todo ranges
Houwie7000 9130c87
[O2B-1503] ranges accepted by fill numbers filter
Houwie7000 0d0986e
[O2B-1503] Added/fixed test lhc-fill overview
Houwie7000 804cd4c
[O2B-1503] doc change
Houwie7000 2f5932a
[O2B-1503] JSDoc enhancements. Extracted duplicate functions to utils…
Houwie7000 1e3f503
[O2B-1503] placeholder text changed
Houwie7000 de7d95b
[O2B-1505] Added beam duration filter to frontend
Houwie7000 cafcba1
[O2B-1505] added simple UI test
Houwie7000 4c28a84
[O2B-1505] Filter+DTO work
Houwie7000 a34340e
[O2B-1505] Beam duration filter works, TODO testing
Houwie7000 9921652
[O2B-1505] tests added/improv
Houwie7000 1c2fffb
[O2B-1505] Fixed tests
Houwie7000 d40bd5c
[O2B-1505] Cleanup, remove logs, docs
Houwie7000 d3c1ead
[O2B-1505] Fixed test
Houwie7000 fe5f6c7
[O2B-1505] Doc fixes
Houwie7000 7628bca
[O2B-1505] remove getStableBeamsOnly
Houwie7000 a533088
[O2B-1505] Fixed 00:00:00 bug, added test
Houwie7000 fd055ca
Merge branch 'main' into feature/O2B-1503/lhcfills-fill-numbers-filter
Houwie7000 6a47048
[O2B-1505] Processed feedback
Houwie7000 8e82b34
[O2B-1503] Processed feedback, added tests
Houwie7000 e5bbc05
[O2B-1503] Added test for splitStringToStringsTrimmed()
Houwie7000 668f90e
Merge branch 'feature/O2B-1503/lhcfills-fill-numbers-filter' into fea…
Houwie7000 a047600
Merge branch 'main' into feature/O2B-1505/lhcfills-beam-duration-filter
Houwie7000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
31 changes: 31 additions & 0 deletions
31
lib/public/components/Filters/LhcFillsFilter/beamDurationFilter.js
This file contains hidden or 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,31 @@ | ||
| /** | ||
| * @license | ||
| * Copyright CERN and copyright holders of ALICE Trg. 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-Trg.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 { comparisonOperatorFilter } from '../common/filters/comparisonOperatorFilter.js'; | ||
| import { rawTextFilter } from '../common/filters/rawTextFilter.js'; | ||
|
|
||
| /** | ||
| * Component to filter LHC-fills by beam duration | ||
| * | ||
| * @param {TextComparisonFilterModel} beamDurationFilterModel beamDurationFilterModel | ||
| * @returns {Component} the text field | ||
| */ | ||
| export const beamDurationFilter = (beamDurationFilterModel) => { | ||
| const amountFilter = rawTextFilter( | ||
| beamDurationFilterModel.operandInputModel, | ||
| { classes: ['w-100', 'beam-duration-filter'], placeholder: 'e.g 16:14:15 (HH:MM:SS)' }, | ||
| ); | ||
|
|
||
| return comparisonOperatorFilter(amountFilter, beamDurationFilterModel.operatorSelectionModel.value, (value) => | ||
| beamDurationFilterModel.operatorSelectionModel.select(value)); | ||
| }; |
79 changes: 79 additions & 0 deletions
79
lib/public/components/Filters/common/filters/TextComparisonFilterModel.js
This file contains hidden or 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,79 @@ | ||
| /** | ||
| * @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 { ComparisonSelectionModel } from './ComparisonSelectionModel.js'; | ||
| import { FilterModel } from '../FilterModel.js'; | ||
| import { RawTextFilterModel } from './RawTextFilterModel.js'; | ||
|
|
||
| /** | ||
| * TextComparisonFilterModel | ||
| */ | ||
| export class TextComparisonFilterModel extends FilterModel { | ||
| /** | ||
| * Constructor | ||
| */ | ||
| constructor() { | ||
| super(); | ||
|
|
||
| this._operatorSelectionModel = new ComparisonSelectionModel(); | ||
| this._operatorSelectionModel.visualChange$.bubbleTo(this._visualChange$); | ||
|
|
||
| this._operandInputModel = new RawTextFilterModel(); | ||
| this._operandInputModel.visualChange$.bubbleTo(this._visualChange$); | ||
| this._operandInputModel.bubbleTo(this); | ||
|
|
||
| this._operatorSelectionModel.observe(() => this._operandInputModel.value ? this.notify() : this._visualChange$.notify()); | ||
| } | ||
|
|
||
| /** | ||
| * Return raw text filter model | ||
| * | ||
| * @return {RawTextFilterModel} operand input model | ||
| */ | ||
| get operandInputModel() { | ||
| return this._operandInputModel; | ||
| } | ||
|
|
||
| /** | ||
| * Get operator selection model | ||
| * | ||
| * @return {ComparisonSelectionModel} selection model | ||
| */ | ||
| get operatorSelectionModel() { | ||
| return this._operatorSelectionModel; | ||
| } | ||
|
|
||
| /** | ||
| * @inheritDoc | ||
| */ | ||
| reset() { | ||
| this._operandInputModel.reset(); | ||
| this._operatorSelectionModel.reset(); | ||
| } | ||
|
|
||
| /** | ||
| * @inheritDoc | ||
| */ | ||
| get normalized() { | ||
| return { | ||
| operator: this._operatorSelectionModel.current, | ||
| limit: this._operandInputModel.value, | ||
| }; | ||
| } | ||
|
|
||
| /** | ||
| * @inheritDoc | ||
| */ | ||
| get isEmpty() { | ||
| return !this._operandInputModel.value; | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,26 @@ | ||
| import Joi from 'joi'; | ||
|
|
||
| /** | ||
| * Validates digital time in string format | ||
| * | ||
| * @param {*} incomingValue The time to validate | ||
| * @param {*} helpers The helpers object | ||
| * @returns {number|import("joi").ValidationError} The value if validation passes, as seconds (Number) | ||
| */ | ||
| export const validateTime = (incomingValue, helpers) => { | ||
| // Checks for valid time format. | ||
| const { error, value } = Joi.string().pattern(/^\d{2}:[0-5]\d:[0-5]\d$/).validate(incomingValue); | ||
|
|
||
| if (error !== undefined) { | ||
| return helpers.error('any.invalid', { message: `Validation error: ${error?.message ?? 'failed to validate time'}` }); | ||
| } | ||
|
|
||
| // Extract time to seconds... | ||
| const [hoursStr, minutesStr, secondsStr] = value.split(':'); | ||
|
|
||
| const hours = Number(hoursStr); | ||
| const minutes = Number(minutesStr); | ||
| const seconds = Number(secondsStr); | ||
|
|
||
| return hours * 3600 + minutes * 60 + seconds; | ||
| }; |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding debounce here is good practice.