Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 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);
8 changes: 6 additions & 2 deletions lib/public/components/Filters/common/FilteringModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ export class FilteringModel extends Observable {
/**
* Reset the filters
*
* @param {boolean} notify call notify on self if true
* @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 @@ -68,7 +72,7 @@ export class FilteringModel extends Observable {
*/
isAnyFilterActive() {
for (const model of this._filterModels) {
if (!model.isEmpty) {
if (typeof model.isEmpty === 'boolean' && !model.isEmpty || typeof model.isEmpty == 'function' && !model.isEmpty()) {
Comment thread
graduta marked this conversation as resolved.
Outdated
return true;
}
}
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);
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 @@ -20,6 +20,7 @@ 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';

/**
* List of active columns for a generic data passes table
Expand All @@ -34,8 +35,8 @@ export const dataPassesActiveColumns = {
visible: true,
sortable: true,
format: (_, dataPass) => formatDataPassName(dataPass),
filter: ({ nameFilterModel }) => textFilter(
nameFilterModel,
filter: (filteringModel) => textFilter(
Comment thread
graduta marked this conversation as resolved.
Outdated
filteringModel.get('names'),
{ class: 'w-75 mt1', placeholder: 'e.g. LHC22a_apass1, ...' },
),
balloon: true,
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('nonPhysics').selectionModel),
visible: false,
},
};
76 changes: 76 additions & 0 deletions lib/public/views/DataPasses/DataPassesOverviewModel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* @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';
Comment thread
xsalonx marked this conversation as resolved.
Outdated
import { SelectionFilterModel } from '../../../components/Filters/common/filters/SelectionFilterModel.js';
import { TextTokensFilterModel } from '../../../components/Filters/common/filters/TextTokensFilterModel.js';
import { NON_PHYSICS_PRODUCTIONS_NAMES_WORDS, NonPhysicsProductionsNamesWords } 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(),
nonPhysics: 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.silentlySetCurrentPage(1);
this.load();
});
}

/**
* Return filter params of base model
*
* @return {object} filter
*/
getFilterParams() {
Comment thread
graduta marked this conversation as resolved.
const nonPhysicsSelectionModel = this._filteringModel.get('nonPhysics').selectionModel;
const filter = {
names: this._filteringModel.get('names').normalized,
includeTest: nonPhysicsSelectionModel.selected.includes(NonPhysicsProductionsNamesWords.TEST),
includeDebug: nonPhysicsSelectionModel.selected.includes(NonPhysicsProductionsNamesWords.DEBUG),
};

return filter;
}

/**
* 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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,19 @@
* granted to it by virtue of its status as an Intergovernmental Organization
* or submit itself to any jurisdiction.
*/
import { TextTokensFilterModel } from '../../../components/Filters/common/filters/TextTokensFilterModel.js';
import { OverviewPageModel } from '../../../models/OverviewModel.js';
import { DataPassesOverviewModel } from '../DataPassesOverviewModel.js';
import { buildUrl } from '/js/src/index.js';

/**
* Data Passes Per LHC Period overview model
*/
export class DataPassesPerLhcPeriodOverviewModel extends OverviewPageModel {
export class DataPassesPerLhcPeriodOverviewModel extends DataPassesOverviewModel {
/**
* Constructor
*/
constructor() {
super();
this._nameFilterModel = new TextTokensFilterModel();
this._registerFilter(this._nameFilterModel);
this._lhcPeriodId = null;
}

/**
Expand All @@ -39,60 +37,21 @@ export class DataPassesPerLhcPeriodOverviewModel extends OverviewPageModel {
* @inheritdoc
*/
getRootEndpoint() {
const filter = this.getFilterParams();
const params = {
filter: {
lhcPeriodIds: [this._lhcPeriodId],
names: this._nameFilterModel.normalized,
...filter,
},
};

return buildUrl('/api/dataPasses', params);
}

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

/**
* Get id of current lhc period which data passes are fetched
*/
get lhcPeriodId() {
return this._lhcPeriodId;
}

/**
* Returns data pass name filter model
* @return {TextTokensFilterModel} data pass name filter model
*/
get nameFilterModel() {
return this._nameFilterModel;
}

/**
* Register a new filter model
* @param {FilterModel} filterModel the filter model to register
* @return {void}
* @private
*/
_registerFilter(filterModel) {
filterModel.visualChange$.bubbleTo(this);
filterModel.observe(() => {
this._pagination.silentlySetCurrentPage(1);
this.load();
});
}

/**
* States whether any filter is active
* @return {boolean} true if any filter is active
*/
isAnyFilterActive() {
return !this._nameFilterModel.isEmpty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const DataPassesPerLhcPeriodOverviewPage = ({ dataPasses: { perLhcPeriodO
return h('', {
onremove: () => dataPassesPerLhcPeriodOverviewModel.reset(),
}, [
h('.flex-row.header-container.pv2', filtersPanelPopover(dataPassesPerLhcPeriodOverviewModel, dataPassesActiveColumns)),
h('.flex-row.header-container.pv2', filtersPanelPopover(dataPassesPerLhcPeriodOverviewModel.filteringModel, dataPassesActiveColumns)),
h('.w-100.flex-column', [
table(
dataPassesPerLhcPeriodOverviewModel.items,
Expand Down
Loading
Loading