Skip to content

Commit 09bda4b

Browse files
committed
merge main
2 parents ac0f77b + 64a1438 commit 09bda4b

25 files changed

Lines changed: 519 additions & 252 deletions

lib/database/seeders/20240112102011-data-passes.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ module.exports = {
4646
updated_at: '2024-02-15 12:00:00',
4747
},
4848

49+
{
50+
id: 6,
51+
name: 'LHC22b_test',
52+
lhc_period_id: 2,
53+
created_at: '2024-02-15 12:00:00',
54+
updated_at: '2024-02-15 12:00:00',
55+
},
56+
57+
{
58+
id: 7,
59+
name: 'LHC22b_debug',
60+
lhc_period_id: 2,
61+
created_at: '2024-02-15 12:00:00',
62+
updated_at: '2024-02-15 12:00:00',
63+
},
64+
4965
/** LHC22a (PbPb) */
5066
{
5167
id: 3,
@@ -111,6 +127,23 @@ module.exports = {
111127
created_at: '2024-02-15 12:00:00',
112128
updated_at: '2024-02-15 12:00:00',
113129
},
130+
131+
{
132+
id: 6,
133+
description: 'test',
134+
data_pass_id: 6,
135+
created_at: '2024-02-15 12:00:00',
136+
updated_at: '2024-02-15 12:00:00',
137+
},
138+
139+
{
140+
id: 7,
141+
description: 'debug',
142+
data_pass_id: 7,
143+
created_at: '2024-02-15 12:00:00',
144+
updated_at: '2024-02-15 12:00:00',
145+
},
146+
114147
], { transaction }),
115148

116149
await queryInterface.bulkInsert('data_pass_version_status_history', [
@@ -197,6 +230,24 @@ module.exports = {
197230
created_at: '2024-02-15 12:30:00',
198231
updated_at: '2024-02-15 12:30:00',
199232
},
233+
234+
/** Data pass version of LHC22b_test */
235+
{
236+
id: 11,
237+
data_pass_version_id: 6,
238+
status: DataPassVersionStatus.RUNNING,
239+
created_at: '2024-02-15 12:30:00',
240+
updated_at: '2024-02-15 12:30:00',
241+
},
242+
243+
/** Data pass version of LHC22b_debug */
244+
{
245+
id: 12,
246+
data_pass_version_id: 7,
247+
status: DataPassVersionStatus.RUNNING,
248+
created_at: '2024-02-15 12:30:00',
249+
updated_at: '2024-02-15 12:30:00',
250+
},
200251
], { transaction }),
201252

202253
await queryInterface.bulkInsert('data_passes_runs', [
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @license
3+
* Copyright 2019-2020 CERN and copyright holders of ALICE O2.
4+
* See http://alice-o2.web.cern.ch/copyright for details of the copyright holders.
5+
* All rights not expressly granted are reserved.
6+
*
7+
* This software is distributed under the terms of the GNU General Public
8+
* License v3 (GPL Version 3), copied verbatim in the file "COPYING".
9+
*
10+
* In applying this license CERN does not waive the privileges and immunities
11+
* granted to it by virtue of its status as an Intergovernmental Organization
12+
* or submit itself to any jurisdiction.
13+
*/
14+
15+
const NonPhysicsProductionsNamesWords = Object.freeze({
16+
TEST: 'test',
17+
DEBUG: 'debug',
18+
});
19+
20+
module.exports.NonPhysicsProductionsNamesWords = NonPhysicsProductionsNamesWords;
21+
22+
module.exports.NON_PHYSICS_PRODUCTIONS_NAMES_WORDS = Object.values(NonPhysicsProductionsNamesWords);

lib/public/components/Filters/common/FilteringModel.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,17 @@ export class FilteringModel extends Observable {
3939
/**
4040
* Reset the filters
4141
*
42+
* @param {boolean} [notify=false] if true the model notifies its observers
4243
* @return {void}
4344
*/
44-
reset() {
45+
reset(notify = false) {
4546
for (const model of this._filterModels) {
4647
model.reset();
4748
}
49+
50+
if (notify) {
51+
this.notify();
52+
}
4853
}
4954

5055
/**
@@ -53,13 +58,14 @@ export class FilteringModel extends Observable {
5358
* @return {object} the normalized values
5459
*/
5560
get normalized() {
56-
const result = {};
61+
const normalizedFilters = {};
5762
for (const [filterKey, filter] of Object.entries(this._filters)) {
5863
if (filter && !filter.isEmpty) {
59-
result[filterKey] = filter.normalized;
64+
normalizedFilters[filterKey] = filter.normalized;
6065
}
6166
}
62-
return expandQueryLikeNestedKey(result);
67+
68+
return expandQueryLikeNestedKey(normalizedFilters);
6369
}
6470

6571
/**

lib/public/components/Filters/common/filters/TextTokensFilterModel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class TextTokensFilterModel extends FilterModel {
6363
* States if the filter has been filled
6464
* @return {boolean} true if the filter is empty
6565
*/
66-
isEmpty() {
66+
get isEmpty() {
6767
return this._raw.length === 0;
6868
}
6969

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @license
3+
* Copyright 2019-2020 CERN and copyright holders of ALICE O2.
4+
* See http://alice-o2.web.cern.ch/copyright for details of the copyright holders.
5+
* All rights not expressly granted are reserved.
6+
*
7+
* This software is distributed under the terms of the GNU General Public
8+
* License v3 (GPL Version 3), copied verbatim in the file "COPYING".
9+
*
10+
* In applying this license CERN does not waive the privileges and immunities
11+
* granted to it by virtue of its status as an Intergovernmental Organization
12+
* or submit itself to any jurisdiction.
13+
*/
14+
15+
export const NonPhysicsProductionsNamesWords = Object.freeze({
16+
TEST: 'test',
17+
DEBUG: 'debug',
18+
});
19+
20+
export const NON_PHYSICS_PRODUCTIONS_NAMES_WORDS = Object.values(NonPhysicsProductionsNamesWords);

lib/public/view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { StatisticsPage } from './views/Statistics/StatisticsPage.js';
3434
import { LhcPeriodsOverviewPage } from './views/lhcPeriods/Overview/LhcPeriodsOverviewPage.js';
3535
import { RunsPerLhcPeriodOverviewPage } from './views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewPage.js';
3636
import { HomePage } from './views/Home/Overview/HomePage.js';
37-
import { DataPassesPerLhcPeriodOverviewPage } from './views/DataPasses/PerLhcPeriodOverview/DataPassesPerLhcPeriodOverviewView.js';
37+
import { DataPassesPerLhcPeriodOverviewPage } from './views/DataPasses/PerLhcPeriodOverview/DataPassesPerLhcPeriodOverviewPage.js';
3838
import { SimulationPassesPerLhcPeriodOverviewPage }
3939
from './views/SimulationPasses/PerLhcPeriodOverview/SimulationPassesPerLhcPeriodOverviewPage.js';
4040
import { DataPassesPerSimulationPassOverviewPage }

lib/public/views/DataPasses/ActiveColumns/dataPassesActiveColumns.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
* or submit itself to any jurisdiction.
1212
*/
1313

14-
import { textFilter } from '../../../components/Filters/common/filters/textFilter.js';
1514
import { frontLink } from '../../../components/common/navigation/frontLink.js';
1615
import { formatSizeInBytes } from '../../../utilities/formatting/formatSizeInBytes.js';
1716
import { formatItemsCount } from '../../../utilities/formatting/formatItemsCount.js';
@@ -20,6 +19,8 @@ import { sumNotNulls } from '../../../utilities/formatting/sumNotNulls.js';
2019
import { h } from '/js/src/index.js';
2120
import { formatDataPassName } from '../format/formatDataPassName.js';
2221
import { formatDataPassStatusHistory } from '../format/formatStatusHistory.js';
22+
import { checkboxes } from '../../../components/Filters/common/filters/checkboxFilter.js';
23+
import { rawTextFilter } from '../../../components/Filters/common/filters/rawTextFilter.js';
2324

2425
/**
2526
* List of active columns for a generic data passes table
@@ -34,9 +35,9 @@ export const dataPassesActiveColumns = {
3435
visible: true,
3536
sortable: true,
3637
format: (_, dataPass) => formatDataPassName(dataPass),
37-
filter: ({ nameFilterModel }) => textFilter(
38-
nameFilterModel,
39-
{ class: 'w-75 mt1', placeholder: 'e.g. LHC22a_apass1, ...' },
38+
filter: (filteringModel) => rawTextFilter(
39+
filteringModel.get('names'),
40+
{ classes: ['w-75', 'mt1'], placeholder: 'e.g. LHC22a_apass1, ...' },
4041
),
4142
balloon: true,
4243
classes: 'w-20',
@@ -90,15 +91,21 @@ export const dataPassesActiveColumns = {
9091
name: 'Reconstructed Events',
9192
format: (_, { versions }) => formatItemsCount(sumNotNulls(versions.map(({ reconstructedEventsCount }) => reconstructedEventsCount))),
9293
visible: true,
93-
sortable: true,
94+
sortable: false,
9495
classes: 'w-10',
9596
},
9697

9798
outputSize: {
9899
name: 'Output Size (B)',
99100
visible: true,
100101
format: (_, { versions }) => formatSizeInBytes(sumNotNulls(versions.map(({ outputSize }) => outputSize))),
101-
sortable: true,
102+
sortable: false,
102103
classes: 'w-10',
103104
},
105+
106+
nonPhysicsProductions: {
107+
name: 'Include nonphysics productions',
108+
filter: (filteringModel) => checkboxes(filteringModel.get('include[byName]').selectionModel),
109+
visible: false,
110+
},
104111
};
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* @license
3+
* Copyright CERN and copyright holders of ALICE O2. This software is
4+
* distributed under the terms of the GNU General Public License v3 (GPL
5+
* Version 3), copied verbatim in the file "COPYING".
6+
*
7+
* See http://alice-o2.web.cern.ch/license for full licensing information.
8+
*
9+
* In applying this license CERN does not waive the privileges and immunities
10+
* granted to it by virtue of its status as an Intergovernmental Organization
11+
* or submit itself to any jurisdiction.
12+
*/
13+
import { FilteringModel } from '../../components/Filters/common/FilteringModel.js';
14+
import { SelectionFilterModel } from '../../components/Filters/common/filters/SelectionFilterModel.js';
15+
import { TextTokensFilterModel } from '../../components/Filters/common/filters/TextTokensFilterModel.js';
16+
import { NON_PHYSICS_PRODUCTIONS_NAMES_WORDS } from '../../domain/enums/NonPhysicsProductionsNamesWords.js';
17+
import { OverviewPageModel } from '../../models/OverviewModel.js';
18+
19+
/**
20+
* Data Passes overview model
21+
*/
22+
export class DataPassesOverviewModel extends OverviewPageModel {
23+
/**
24+
* Constructor
25+
*/
26+
constructor() {
27+
super();
28+
this._filteringModel = new FilteringModel({
29+
names: new TextTokensFilterModel(),
30+
'include[byName]': new SelectionFilterModel({
31+
availableOptions: NON_PHYSICS_PRODUCTIONS_NAMES_WORDS.map((word) => ({ label: word.toUpperCase(), value: word })),
32+
}),
33+
});
34+
35+
this._filteringModel.visualChange$.bubbleTo(this);
36+
this._filteringModel.observe(() => {
37+
this._pagination.currentPage = 1;
38+
this.load();
39+
});
40+
}
41+
42+
/**
43+
* Return filter params of base model
44+
*
45+
* @return {object} filter
46+
*/
47+
getFilterParams() {
48+
return this._filteringModel.normalized;
49+
}
50+
51+
/**
52+
* Reset this model to its default
53+
*
54+
* @returns {void}
55+
*/
56+
reset() {
57+
this._filteringModel.reset();
58+
super.reset();
59+
}
60+
61+
/**
62+
* Return the filtering model
63+
*
64+
* @return {FilteringModel} the filtering model
65+
*/
66+
get filteringModel() {
67+
return this._filteringModel;
68+
}
69+
}

lib/public/views/DataPasses/PerLhcPeriodOverview/DataPassesPerLhcPeriodOverviewModel.js

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,19 @@
1010
* granted to it by virtue of its status as an Intergovernmental Organization
1111
* or submit itself to any jurisdiction.
1212
*/
13-
import { TextTokensFilterModel } from '../../../components/Filters/common/filters/TextTokensFilterModel.js';
14-
import { OverviewPageModel } from '../../../models/OverviewModel.js';
13+
import { DataPassesOverviewModel } from '../DataPassesOverviewModel.js';
1514
import { buildUrl } from '/js/src/index.js';
1615

1716
/**
1817
* Data Passes Per LHC Period overview model
1918
*/
20-
export class DataPassesPerLhcPeriodOverviewModel extends OverviewPageModel {
19+
export class DataPassesPerLhcPeriodOverviewModel extends DataPassesOverviewModel {
2120
/**
2221
* Constructor
2322
*/
2423
constructor() {
2524
super();
26-
this._nameFilterModel = new TextTokensFilterModel();
27-
this._registerFilter(this._nameFilterModel);
25+
this._lhcPeriodId = null;
2826
}
2927

3028
/**
@@ -39,60 +37,21 @@ export class DataPassesPerLhcPeriodOverviewModel extends OverviewPageModel {
3937
* @inheritdoc
4038
*/
4139
getRootEndpoint() {
40+
const filter = this.getFilterParams();
4241
const params = {
4342
filter: {
4443
lhcPeriodIds: [this._lhcPeriodId],
45-
names: this._nameFilterModel.normalized,
44+
...filter,
4645
},
4746
};
4847

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

52-
/**
53-
* Reset this model to its default
54-
*
55-
* @returns {void}
56-
*/
57-
reset() {
58-
this._nameFilterModel.reset();
59-
super.reset();
60-
}
61-
6251
/**
6352
* Get id of current lhc period which data passes are fetched
6453
*/
6554
get lhcPeriodId() {
6655
return this._lhcPeriodId;
6756
}
68-
69-
/**
70-
* Returns data pass name filter model
71-
* @return {TextTokensFilterModel} data pass name filter model
72-
*/
73-
get nameFilterModel() {
74-
return this._nameFilterModel;
75-
}
76-
77-
/**
78-
* Register a new filter model
79-
* @param {FilterModel} filterModel the filter model to register
80-
* @return {void}
81-
* @private
82-
*/
83-
_registerFilter(filterModel) {
84-
filterModel.visualChange$.bubbleTo(this);
85-
filterModel.observe(() => {
86-
this._pagination.silentlySetCurrentPage(1);
87-
this.load();
88-
});
89-
}
90-
91-
/**
92-
* States whether any filter is active
93-
* @return {boolean} true if any filter is active
94-
*/
95-
isAnyFilterActive() {
96-
return !this._nameFilterModel.isEmpty();
97-
}
9857
}

lib/public/views/DataPasses/PerLhcPeriodOverview/DataPassesPerLhcPeriodOverviewView.js renamed to lib/public/views/DataPasses/PerLhcPeriodOverview/DataPassesPerLhcPeriodOverviewPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const DataPassesPerLhcPeriodOverviewPage = ({ dataPasses: { perLhcPeriodO
5050
return h('', {
5151
onremove: () => dataPassesPerLhcPeriodOverviewModel.reset(),
5252
}, [
53-
h('.flex-row.header-container.pv2', filtersPanelPopover(dataPassesPerLhcPeriodOverviewModel, dataPassesActiveColumns)),
53+
h('.flex-row.header-container.pv2', filtersPanelPopover(dataPassesPerLhcPeriodOverviewModel.filteringModel, dataPassesActiveColumns)),
5454
h('.w-100.flex-column', [
5555
table(
5656
dataPassesPerLhcPeriodOverviewModel.items,

0 commit comments

Comments
 (0)