Skip to content

Commit f885282

Browse files
committed
wip
1 parent 0ecef06 commit f885282

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

lib/domain/dtos/filters/RunFilterDto.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ exports.RunFilterDto = Joi.object({
121121

122122
detectorsQc: Joi.object()
123123
.pattern(
124-
Joi.string().regex(/^_[0-9]+$/),
124+
Joi.string().regex(/^_\d+$/),
125125
Joi.object({ notBadFraction: FloatComparisonDto }),
126126
)
127127
.keys({
@@ -131,9 +131,10 @@ exports.RunFilterDto = Joi.object({
131131
const [{ dataPassIds, simulationPassIds, lhcPeriodIds }] = helpers.state.ancestors;
132132
const filters = [dataPassIds, simulationPassIds, lhcPeriodIds].filter((x) => Array.isArray(x) && x.length === 1);
133133

134-
if (filters.length !== 1 && Object.keys(value).some((k) => /^_[0-9]+$/.test(k))) {
134+
if (filters.length !== 1 && Object.keys(value).some((k) => /^_\d+$/.test(k))) {
135135
return helpers.error('any.invalid', {
136-
message: 'Filtering by detector not-bad fraction is allowed only with exactly one of: dataPassIds, simulationPassIds, lhcPeriodIds with exactly one ID.',
136+
message: 'Filtering by detector not-bad fraction is allowed only with exactly one of: ' +
137+
'dataPassIds, simulationPassIds, lhcPeriodIds with exactly one ID.',
137138
});
138139
}
139140

lib/public/components/Filters/common/FilteringModel.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,18 @@ export class FilteringModel extends Observable {
9797

9898
return this._filters[key];
9999
}
100+
101+
/**
102+
* Add new filter
103+
*
104+
* @param {string} key key of a new filter
105+
* @param {FilterModel} filter the new filter
106+
*/
107+
put(key, filter) {
108+
if (key in this._filters) {
109+
throw new Error(`Filter under key ${key} already exists`);
110+
}
111+
112+
this._filters[key] = filter;
113+
}
100114
}

0 commit comments

Comments
 (0)