-
Notifications
You must be signed in to change notification settings - Fork 14
[OGUI-1760] Update search UI for object path and add filters #3065
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
Merged
graduta
merged 25 commits into
dev
from
feature/QCG/OGUI-1760/update-search-ui-for-objectPath
Sep 24, 2025
Merged
Changes from 17 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
b43546a
Search/filter layout functionality in Model
Houwie7000 37df26e
Filters work in progress, TODO filter finetuning and UI
Houwie7000 bbb5b99
WIP Mithril fighting
Houwie7000 f539c53
old search moved and preserved, tests fixed. Filter popover present, …
Houwie7000 fd99dac
Friendly name used
Houwie7000 d74068e
Filtering system works in conjunction with classic search. Added VSCo…
Houwie7000 98eecce
tests added + fixed
Houwie7000 1606cc9
Update placeholders
Houwie7000 fb43fe6
Fix rebase
Houwie7000 bff7808
Ui now shows active filters
Houwie7000 710cb66
Create a singular object to send to the backend for filtering
Houwie7000 84892d7
Style fix + add test for active filter text
Houwie7000 9e762f8
Add extra documentation to getLayouts
Houwie7000 a054459
Code cleanup
Houwie7000 768ad12
Merge branch 'dev' into feature/QCG/OGUI-1760/update-search-ui-for-ob…
Houwie7000 f8ce94b
Fix bad parameter
Houwie7000 b34779b
Bad parameter 2
Houwie7000 c5cd6e8
Process feedback
Houwie7000 7ff33cf
Merge branch 'dev' into feature/QCG/OGUI-1760/update-search-ui-for-ob…
Houwie7000 1df126d
Fix bad merge
Houwie7000 02965cc
Processed feedback part 2
Houwie7000 2449531
Fix spelling mistake
graduta fa7b912
Do not export as default class
graduta 76ff208
Remove unwanted filter registration
graduta 5c4d4f3
Merge branch 'dev' into feature/QCG/OGUI-1760/update-search-ui-for-ob…
graduta 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
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,75 @@ | ||
/** | ||
* @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. | ||
*/ | ||
|
||
/** | ||
* @typedef {object} Filter | ||
* @property {string} key - searchable key of the filter. | ||
* @property {function(): (string)} friendlyName - friendly name of the filter else key. | ||
* @property {function(): (string)} inputPlaceholder - Input element's placeholder, use examples of filter. | ||
* @property {function(): (boolean)} isActive - has the filter any active value('s) | ||
* @property {function(): (string|string[]|null)} getValue - gets the current value('s) of the filter | ||
* @property {function(string): void} set - set value of the filter | ||
* @property {Function} reset - reset filter to default state | ||
*/ | ||
|
||
/** | ||
* creates a key-value filter. | ||
* @param {string} key - key used to save and retrieve value. | ||
* @param {string|null} friendlyName - friendly name of the filter. | ||
* @param {string|null} inputPlaceholder - input placeholder text. | ||
* @param {string} value - value associated with key. | ||
* @returns {Filter} key-value filter object. | ||
*/ | ||
export function createKeyValueFilter(key, friendlyName = null, inputPlaceholder = null, value = '') { | ||
return { | ||
key, | ||
friendlyName: () => friendlyName ? friendlyName : key, | ||
inputPlaceholder: () => inputPlaceholder ? inputPlaceholder : 'Conditions', | ||
getValue: () => value ? value : null, | ||
// trim checks if value is a string value, test this | ||
graduta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
isActive: () => Boolean(value && value.trim()), | ||
set: (v) => { | ||
graduta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
value = v; | ||
}, | ||
reset: () => { | ||
graduta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
value = ''; | ||
}, | ||
}; | ||
} | ||
|
||
/** | ||
* Creates a multiple value filter, key with array value. | ||
* Not used in the code yet but serves as an example. | ||
graduta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
* @param {string} key - key used to save and retrieve value. | ||
* @param {string|null} friendlyName - friendly name of the filter. | ||
* @param {string|null} inputPlaceholder - input placeholder text. | ||
* @param {Array<string>} value - values (array) associated with key. | ||
* @returns {Filter} multiple value filter, key with array with values. | ||
*/ | ||
export function createMultiValueFilter(key, friendlyName = null, inputPlaceholder = null, value = []) { | ||
let values = Array.isArray(value) ? value : []; | ||
return { | ||
key, | ||
friendlyName: () => friendlyName ? friendlyName : key, | ||
inputPlaceholder: () => inputPlaceholder ? inputPlaceholder : 'Conditions', | ||
getValue: () => values, | ||
isActive: () => values.length > 0, | ||
set: (arr) => { | ||
values = Array.isArray(arr) ? arr : []; | ||
}, | ||
reset: () => { | ||
values = []; | ||
}, | ||
}; | ||
} |
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
92 changes: 92 additions & 0 deletions
92
QualityControl/public/pages/layoutListView/filtersPanelPopover.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,92 @@ | ||
/** | ||
* @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. | ||
*/ | ||
|
||
// Adopted from Bookkeeping/lib/public/components/Filters/common/filtersPanelPopover.js | ||
import { h, popover, PopoverAnchors, PopoverTriggerPreConfiguration } from '/js/src/index.js'; | ||
// import { tooltip } from '../../common/popover/tooltip.js'; | ||
graduta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
/** | ||
* imports for JSDoc + VSCode navigation: | ||
* @import SearchFilterModel from './model/SearchFilterModel.js'; | ||
*/ | ||
|
||
/** | ||
* Return the filters panel popover trigger | ||
* @returns {Component} the button component | ||
*/ | ||
const filtersToggleTrigger = () => h('button#openFilterToggle.btn.btn.btn-primary', 'Filters'); | ||
|
||
/** | ||
* Create main header of the filters panel | ||
* @param {SearchFilterModel} searchFilterModel {@link SearchFilterModel} filtering model. | ||
* @returns {Component} main panel header. | ||
*/ | ||
const filtersToggleContentHeader = (searchFilterModel) => h('.flex-row.justify-between', [ | ||
h('.f4', 'Filters'), | ||
h( | ||
'button#reset-filters.btn.btn-danger', | ||
{ | ||
onclick: () => { | ||
searchFilterModel.resetAll(); | ||
graduta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
}, | ||
disabled: searchFilterModel.allInActive() ? true : false, | ||
}, | ||
'Reset all filters', | ||
), | ||
]); | ||
|
||
/** | ||
* Return the filters panel popover content section | ||
* @param {SearchFilterModel} searchFilterModel the searchFilter model | ||
* @returns {Component} the filters section | ||
*/ | ||
export const filtersSection = (searchFilterModel = {}) => [ | ||
searchFilterModel.getAll().flatMap((filter) => [ | ||
h('.flex-row.g2', [ | ||
h('.w-30.f5.flex-row.items-center.g2', [filter.friendlyName()]), | ||
graduta marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
h('.w-70', [ | ||
h('input.form-control.w-100', { | ||
placeholder: filter.inputPlaceholder(), | ||
type: 'text', | ||
value: filter.getValue(), | ||
onchange: (e) => searchFilterModel.setValue(filter.key, e.target.value), | ||
}), | ||
]), | ||
]), | ||
]), | ||
]; | ||
|
||
/** | ||
* Return the filters panel popover content (i.e. the actual filters) | ||
* @param {SearchFilterModel} searchFilterModel the filtering model | ||
* @returns {Component} the filters panel | ||
*/ | ||
const filtersToggleContent = (searchFilterModel) => h('.w-l.flex-column.p3.g3', [ | ||
filtersToggleContentHeader(searchFilterModel), | ||
filtersSection(searchFilterModel), | ||
]); | ||
|
||
/** | ||
* Return component composed of the filtering popover and its button trigger | ||
* @param {SearchFilterModel} searchFilterModel the filtering model | ||
* @returns {Component} the filter component | ||
*/ | ||
export const filtersPanelPopover = (searchFilterModel) => popover( | ||
filtersToggleTrigger(), | ||
filtersToggleContent(searchFilterModel), | ||
{ | ||
...PopoverTriggerPreConfiguration.click, | ||
anchor: PopoverAnchors.RIGHT_START, | ||
}, | ||
); |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.