Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions lib/database/seeders/20240112102011-data-passes.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ module.exports = {
updated_at: '2024-02-15 12:00:00',
},

{
id: 6,
name: 'LHC22b_test',
lhc_period_id: 2,
created_at: '2024-02-15 12:00:00',
updated_at: '2024-02-15 12:00:00',
},

{
id: 7,
name: 'LHC22b_debug',
lhc_period_id: 2,
created_at: '2024-02-15 12:00:00',
updated_at: '2024-02-15 12:00:00',
},

/** LHC22a (PbPb) */
{
id: 3,
Expand Down Expand Up @@ -111,6 +127,23 @@ module.exports = {
created_at: '2024-02-15 12:00:00',
updated_at: '2024-02-15 12:00:00',
},

{
id: 6,
description: 'test',
data_pass_id: 6,
created_at: '2024-02-15 12:00:00',
updated_at: '2024-02-15 12:00:00',
},

{
id: 7,
description: 'debug',
data_pass_id: 7,
created_at: '2024-02-15 12:00:00',
updated_at: '2024-02-15 12:00:00',
},

], { transaction }),

await queryInterface.bulkInsert('data_pass_version_status_history', [
Expand Down Expand Up @@ -197,6 +230,24 @@ module.exports = {
created_at: '2024-02-15 12:30:00',
updated_at: '2024-02-15 12:30:00',
},

/** Data pass version of LHC22b_test */
{
id: 11,
data_pass_version_id: 6,
status: DataPassVersionStatus.RUNNING,
created_at: '2024-02-15 12:30:00',
updated_at: '2024-02-15 12:30:00',
},

/** Data pass version of LHC22b_debug */
{
id: 12,
data_pass_version_id: 7,
status: DataPassVersionStatus.RUNNING,
created_at: '2024-02-15 12:30:00',
updated_at: '2024-02-15 12:30:00',
},
], { transaction }),

await queryInterface.bulkInsert('data_passes_runs', [
Expand Down
22 changes: 22 additions & 0 deletions lib/domain/enums/NonPhysicsProductionsNamesRoles.js
Original file line number Diff line number Diff line change
@@ -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.
*/

const NonPhysicsProductionsNamesWords = Object.freeze({
TEST: 'test',
DEBUG: 'debug',
});

module.exports.NonPhysicsProductionsNamesWords = NonPhysicsProductionsNamesWords;

module.exports.NON_PHYSICS_PRODUCTIONS_NAMES_WORDS = Object.values(NonPhysicsProductionsNamesWords);
15 changes: 11 additions & 4 deletions lib/public/components/Filters/common/FilteringModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* or submit itself to any jurisdiction.
*/

import { expandQueryLikeNestedKey } from '../../../utilities/expandNestedKey.js';
import { Observable } from '/js/src/index.js';

/**
Expand Down Expand Up @@ -38,12 +39,17 @@ export class FilteringModel extends Observable {
/**
* Reset the filters
*
* @param {boolean} [notify=false] if true the model notifies its observers
* @return {void}
*/
reset() {
reset(notify = false) {
Comment thread
graduta marked this conversation as resolved.
for (const model of this._filterModels) {
model.reset();
}

if (notify) {
this.notify();
}
}

/**
Expand All @@ -52,13 +58,14 @@ export class FilteringModel extends Observable {
* @return {object} the normalized values
*/
get normalized() {
const ret = {};
const normalizedFilters = {};
for (const [filterKey, filter] of Object.entries(this._filters)) {
if (filter && !filter.isEmpty) {
ret[filterKey] = filter.normalized;
normalizedFilters[filterKey] = filter.normalized;
}
}
return ret;

return expandQueryLikeNestedKey(normalizedFilters);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class TextTokensFilterModel extends FilterModel {
* States if the filter has been filled
* @return {boolean} true if the filter is empty
*/
isEmpty() {
get isEmpty() {
return this._raw.length === 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const filtersToggleContent = (
{
onclick: () => filteringModel.resetFiltering
? filteringModel.resetFiltering()
: filteringModel.reset(),
: filteringModel.reset(true),
disabled: !filteringModel.isAnyFilterActive(),
},
'Reset all filters',
Expand Down
20 changes: 20 additions & 0 deletions lib/public/domain/enums/NonPhysicsProductionsNamesWords.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* @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.
*/

export const NonPhysicsProductionsNamesWords = Object.freeze({
TEST: 'test',
DEBUG: 'debug',
});

export const NON_PHYSICS_PRODUCTIONS_NAMES_WORDS = Object.values(NonPhysicsProductionsNamesWords);
42 changes: 42 additions & 0 deletions lib/public/utilities/expandNestedKey.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* @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.
*/

/**
* Expand query-like formatted keys of a object { a[b][c]: x } to { a: { b: { c: x } } }
*
* @param {object} obj a object
* @return {object} obj
*/
export function expandQueryLikeNestedKey(obj) {
const result = {};

for (const nestedKey in obj) {
const value = obj[nestedKey];
const subKeys = nestedKey.split(/[[\]]/).filter(Boolean);

let currentNestedObj = result;
for (let i = 0; i < subKeys.length; i++) {
const key = subKeys[i];
if (i === subKeys.length - 1) {
currentNestedObj[key] = value;
} else {
if (!(key in currentNestedObj)) {
currentNestedObj[key] = {};
}
currentNestedObj = currentNestedObj[key];
}
}
}

return result;
}
2 changes: 1 addition & 1 deletion lib/public/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { StatisticsPage } from './views/Statistics/StatisticsPage.js';
import { LhcPeriodsOverviewPage } from './views/lhcPeriods/Overview/LhcPeriodsOverviewPage.js';
import { RunsPerLhcPeriodOverviewPage } from './views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewPage.js';
import { HomePage } from './views/Home/Overview/HomePage.js';
import { DataPassesPerLhcPeriodOverviewPage } from './views/DataPasses/PerLhcPeriodOverview/DataPassesPerLhcPeriodOverviewView.js';
import { DataPassesPerLhcPeriodOverviewPage } from './views/DataPasses/PerLhcPeriodOverview/DataPassesPerLhcPeriodOverviewPage.js';
import { SimulationPassesPerLhcPeriodOverviewPage }
from './views/SimulationPasses/PerLhcPeriodOverview/SimulationPassesPerLhcPeriodOverviewPage.js';
import { DataPassesPerSimulationPassOverviewPage }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* or submit itself to any jurisdiction.
*/

import { textFilter } from '../../../components/Filters/common/filters/textFilter.js';
import { frontLink } from '../../../components/common/navigation/frontLink.js';
import { formatSizeInBytes } from '../../../utilities/formatting/formatSizeInBytes.js';
import { formatItemsCount } from '../../../utilities/formatting/formatItemsCount.js';
Expand All @@ -20,6 +19,8 @@ import { sumNotNulls } from '../../../utilities/formatting/sumNotNulls.js';
import { h } from '/js/src/index.js';
import { formatDataPassName } from '../format/formatDataPassName.js';
import { formatDataPassStatusHistory } from '../format/formatStatusHistory.js';
import { checkboxes } from '../../../components/Filters/common/filters/checkboxFilter.js';
import { rawTextFilter } from '../../../components/Filters/common/filters/rawTextFilter.js';

/**
* List of active columns for a generic data passes table
Expand All @@ -34,9 +35,9 @@ export const dataPassesActiveColumns = {
visible: true,
sortable: true,
format: (_, dataPass) => formatDataPassName(dataPass),
filter: ({ nameFilterModel }) => textFilter(
nameFilterModel,
{ class: 'w-75 mt1', placeholder: 'e.g. LHC22a_apass1, ...' },
filter: (filteringModel) => rawTextFilter(
filteringModel.get('names'),
{ classes: ['w-75', 'mt1'], placeholder: 'e.g. LHC22a_apass1, ...' },
),
balloon: true,
classes: 'w-20',
Expand Down Expand Up @@ -90,15 +91,21 @@ export const dataPassesActiveColumns = {
name: 'Reconstructed Events',
format: (_, { versions }) => formatItemsCount(sumNotNulls(versions.map(({ reconstructedEventsCount }) => reconstructedEventsCount))),
visible: true,
sortable: true,
sortable: false,
classes: 'w-10',
},

outputSize: {
name: 'Output Size (B)',
visible: true,
format: (_, { versions }) => formatSizeInBytes(sumNotNulls(versions.map(({ outputSize }) => outputSize))),
sortable: true,
sortable: false,
classes: 'w-10',
},

nonPhysicsProductions: {
name: 'Include nonphysics productions',
filter: (filteringModel) => checkboxes(filteringModel.get('include[byName]').selectionModel),
Comment thread
xsalonx marked this conversation as resolved.
visible: false,
},
};
69 changes: 69 additions & 0 deletions lib/public/views/DataPasses/DataPassesOverviewModel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* @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 { FilteringModel } from '../../components/Filters/common/FilteringModel.js';
import { SelectionFilterModel } from '../../components/Filters/common/filters/SelectionFilterModel.js';
import { TextTokensFilterModel } from '../../components/Filters/common/filters/TextTokensFilterModel.js';
import { NON_PHYSICS_PRODUCTIONS_NAMES_WORDS } from '../../domain/enums/NonPhysicsProductionsNamesWords.js';
import { OverviewPageModel } from '../../models/OverviewModel.js';

/**
* Data Passes overview model
*/
export class DataPassesOverviewModel extends OverviewPageModel {
/**
* Constructor
*/
constructor() {
super();
this._filteringModel = new FilteringModel({
names: new TextTokensFilterModel(),
'include[byName]': new SelectionFilterModel({
availableOptions: NON_PHYSICS_PRODUCTIONS_NAMES_WORDS.map((word) => ({ label: word.toUpperCase(), value: word })),
}),
});

this._filteringModel.visualChange$.bubbleTo(this);
this._filteringModel.observe(() => {
this._pagination.currentPage = 1;
this.load();
});
}

/**
* Return filter params of base model
*
* @return {object} filter
*/
getFilterParams() {
Comment thread
graduta marked this conversation as resolved.
return this._filteringModel.normalized;
}

/**
* Reset this model to its default
*
* @returns {void}
*/
reset() {
this._filteringModel.reset();
super.reset();
}

/**
* Return the filtering model
*
* @return {FilteringModel} the filtering model
*/
get filteringModel() {
return this._filteringModel;
}
}
Loading
Loading