From 7692359f0ed62308a98f46b2d4c17bd968ac6a6c Mon Sep 17 00:00:00 2001 From: hehoon <100522372+hehoon@users.noreply.github.com> Date: Sat, 10 Jan 2026 18:33:13 +0100 Subject: [PATCH] Add detector filter option with grouped dropdown --- QualityControl/lib/dtos/ObjectGetDto.js | 2 + .../lib/dtos/filters/QcDetectorNameDto.js | 22 ++++++ .../public/common/filters/filter.js | 75 +++++++++++++++++++ .../public/common/filters/filterTypes.js | 1 + .../public/common/filters/filterViews.js | 9 ++- .../public/common/filters/filtersConfig.js | 23 +++++- .../common/filters/model/FilterModel.js | 2 +- .../public/services/Filter.service.js | 33 ++++++-- .../test/public/pages/object-tree.test.js | 31 ++++++++ 9 files changed, 187 insertions(+), 11 deletions(-) create mode 100644 QualityControl/lib/dtos/filters/QcDetectorNameDto.js diff --git a/QualityControl/lib/dtos/ObjectGetDto.js b/QualityControl/lib/dtos/ObjectGetDto.js index 1aee13e5f..43c93b88f 100644 --- a/QualityControl/lib/dtos/ObjectGetDto.js +++ b/QualityControl/lib/dtos/ObjectGetDto.js @@ -14,6 +14,7 @@ import Joi from 'joi'; import { RunNumberDto } from './filters/RunNumberDto.js'; +import { QcDetectorNameDto } from './filters/QcDetectorNameDto.js'; const periodNamePattern = /^LHC\d{1,2}[a-z0-9]+$/i; @@ -25,6 +26,7 @@ const periodNamePattern = /^LHC\d{1,2}[a-z0-9]+$/i; function createFiltersSchema(runTypes) { return Joi.object({ RunNumber: RunNumberDto.optional(), + QcDetectorName: QcDetectorNameDto.optional(), RunType: runTypes.length > 0 ? Joi.string().valid(...runTypes).optional() : Joi.string().optional(), diff --git a/QualityControl/lib/dtos/filters/QcDetectorNameDto.js b/QualityControl/lib/dtos/filters/QcDetectorNameDto.js new file mode 100644 index 000000000..a067d8e54 --- /dev/null +++ b/QualityControl/lib/dtos/filters/QcDetectorNameDto.js @@ -0,0 +1,22 @@ +/** + * @license + * Copyright 2019-2020 CERN and copyright holders of ALICE O2. + * See http://alice-o2.web.cern.ch/copyright for details of the copyright holders. + * All rights not expressly granted are reserved. + * + * This software is distributed under the terms of the GNU General Public + * License v3 (GPL Version 3), copied verbatim in the file "COPYING". + * + * 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 Joi from 'joi'; + +export const QcDetectorNameDto = Joi.string() + .min(1) + .messages({ + 'number.base': 'Detector name must be a string', + 'number.min': 'Detector name must not be an empty string', + }); diff --git a/QualityControl/public/common/filters/filter.js b/QualityControl/public/common/filters/filter.js index 6d658d9e2..4fec31dfa 100644 --- a/QualityControl/public/common/filters/filter.js +++ b/QualityControl/public/common/filters/filter.js @@ -61,6 +61,81 @@ export const dynamicSelector = (config) => { }); }; +/** + * Represents options grouped for HTML . + * Keys are group labels (for the label), + * values are arrays of option values (for