-
Notifications
You must be signed in to change notification settings - Fork 21
[O2B-1595] Add filterable overview page class #2172
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 26 commits into
main
from
improv/O2B-1595/add-filterable-overview-page-class
Jun 19, 2026
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
fe19db7
chore: rename fetchLogs to load
94b04f7
chore: rename overviewSortModel to sortModel
6efeb00
load patch
41f2678
chore: rename logs to items$
eb4ed78
feat: make logsOverveiwModel extend overviewModel
d20f115
chore: fix spelling mistake
aa2af05
feat: create FilterableOverviewPageModel
5936b8e
feat: migrate datapassesOverviewModel
37ec014
feat: migrate environmentsOverviewModel
6a2806a
feat: migrate LhcFillsOverviewModel
855e4a0
feat: migrate LhcPeriodsOverviewModel
81c0e06
feat: migrate LogsOverviewModel
4e55f37
feat: migrate QCFlagTypesOverviewModel
7f5f857
feat: migrate RunsOverviewModel
218af8f
feat: migrate AnchoredSimulationPassesOverviewModel
9dcd8fa
feat: migrate SimulationPassesPerLhcPeriodOverviewModel
1fcdf9e
Merge branch 'main' into improv/O2B-1595/add-filterable-overview-page…
db4490f
patch-up reset of runs
8a7dfa0
chore: add jsdoc arguments for FilterablePageOverviewModel constructor
130d00b
chore: remove needless resetFilters from runsOverviewModel
eb060a9
chore: remove useless commands from LhcPeriodsOverviewModel
26a337e
remove debounce functionallity from logsOverviewModel
1b4d532
prevent multiple fetches from repeated observations
6317575
remove debounce functionallity from EnvironmentsOverviewModel
8059d2c
remove debounce functionallity from EnvironmentsOverviewModel
33c084b
fix eslint issues
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| /** | ||
| * @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 '/js/src/index.js'; | ||
| import { OverviewPageModel } from './OverviewModel.js'; | ||
| import { FilteringModel } from '../components/Filters/common/FilteringModel.js'; | ||
|
|
||
| /** | ||
| * Base model for a filterable overview page | ||
| * | ||
| * @template T the type of data displayed in the overview page | ||
| */ | ||
| export class FilterableOverviewPageModel extends OverviewPageModel { | ||
| /** | ||
| * Constructor | ||
| * @param {QueryRouter} router router that controls the application's page navigation | ||
| * @param {string} pageIdentifier string that indicates what page this model represents | ||
| * @param {Object<string, FilterModel>} filters the filters with their label and model | ||
| */ | ||
| constructor(router, pageIdentifier, filters) { | ||
| super(); | ||
| this._filteringModel = new FilteringModel(router, filters, this._warnings); | ||
|
|
||
| this._filteringModel.pageIdentifier = pageIdentifier; | ||
| this._filteringModel.visualChange$.bubbleTo(this); | ||
| this._filteringModel.observe(() => this._applyFilters()); | ||
| this._sortModel.unobserve(this._sortModelCallback); | ||
| this._sortModel.observe(() => this._applyFilters()); | ||
|
graduta marked this conversation as resolved.
|
||
| this._debouncedLoad = (_time) => {}; // Abstract, does nothing on purpose | ||
| this._fetchInstantly = true; | ||
| } | ||
|
|
||
| /** | ||
| * Builds a url string from filters and a base string | ||
| * | ||
| * @param {string} base the base string from which the endpoint will be built | ||
| * @return {string} | ||
| */ | ||
| buildRootEndpoint(base) { | ||
| return buildUrl(base, { filter: this.getFilterParams() }); | ||
| } | ||
|
|
||
| /** | ||
| * Sets the fetchInstantly boolean | ||
| * @param {boolean} bool the value to set | ||
| * @return {void} | ||
| */ | ||
| set fetchInstantly(bool) { | ||
| this._fetchInstantly = bool; | ||
| } | ||
|
|
||
| /** | ||
| * Returns all filtering, sorting and pagination settings to their default values | ||
| * @param {boolean} [fetch = true] whether to refetch all data after filters have been reset | ||
| * @return {void} | ||
| */ | ||
| reset(fetch = true) { | ||
| super.reset(); | ||
| this.resetFiltering(fetch); | ||
| } | ||
|
|
||
| /** | ||
| * Reset all filtering models | ||
| * @param {boolean} fetch Whether to refetch all data after filters have been reset | ||
| * @param {boolean} [clearUrl=false] if true filters will be removed from the url | ||
| * @return {void} | ||
| */ | ||
| resetFiltering(fetch = true, clearUrl = false) { | ||
| this._filteringModel.reset(false, clearUrl); | ||
|
|
||
| if (fetch) { | ||
| this._applyFilters(true); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Checks if any filter value has been modified from their default (empty) | ||
| * @return {Boolean} If any filter is active | ||
| */ | ||
| isAnyFilterActive() { | ||
| return this._filteringModel.isAnyFilterActive(); | ||
| } | ||
|
|
||
| /** | ||
| * Apply the current filtering and update the remote data list | ||
| * | ||
| * @param {boolean} now if true, filtering will be applied now without debouncing | ||
| * | ||
| * @return {void} | ||
| */ | ||
| _applyFilters() { | ||
| this._pagination.silentlySetCurrentPage(1); | ||
| this._fetchInstantly ? this.load() : this._debouncedLoad(); | ||
| } | ||
|
|
||
| /** | ||
| * Set underlying FilteringModel's filters from the query parameters in the URL | ||
| * | ||
| * @param {boolean} notify if the FilteringModel should notify it's observers after finishing setting the filters | ||
| */ | ||
| setFilterFromURL(notify) { | ||
| this._filteringModel.setFilterFromURL(notify); | ||
| } | ||
|
|
||
| /** | ||
| * Return the filtering model | ||
| * | ||
| * @return {FilteringModel} the filtering model | ||
| */ | ||
| get filteringModel() { | ||
| return this._filteringModel; | ||
| } | ||
|
|
||
| /** | ||
| * Return filter params of base model | ||
| * | ||
| * @return {object} filter | ||
| */ | ||
| getFilterParams() { | ||
| return this._filteringModel.normalized; | ||
| } | ||
| } | ||
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
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.