-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathRunsModel.js
More file actions
149 lines (137 loc) · 5.46 KB
/
Copy pathRunsModel.js
File metadata and controls
149 lines (137 loc) · 5.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/**
* @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 { Observable } from '/js/src/index.js';
import { RunDetailsModel } from './Details/RunDetailsModel.js';
import { RunsOverviewModel } from './Overview/RunsOverviewModel.js';
import { RunsPerLhcPeriodOverviewModel } from './RunPerPeriod/RunsPerLhcPeriodOverviewModel.js';
import { RunsPerDataPassOverviewModel } from './RunPerDataPass/RunsPerDataPassOverviewModel.js';
import { RunsPerSimulationPassOverviewModel } from './RunsPerSimulationPass/RunsPerSimulationPassOverviewModel.js';
/**
* Model representing handlers for runs page
*
*/
export class RunsModel extends Observable {
/**
* The constructor of the Overview model object
* @param {Model} model Pass the model to access the defined functions
* @return {Object} Constructs the Overview model
*/
constructor(model) {
super();
this._detailsModel = new RunDetailsModel();
this._detailsModel.bubbleTo(this);
this._overviewModel = new RunsOverviewModel(model);
this._overviewModel.bubbleTo(this);
this._perLhcPeriodOverviewModel = new RunsPerLhcPeriodOverviewModel(model);
this._perLhcPeriodOverviewModel.bubbleTo(this);
this._perDataPassOverviewModel = new RunsPerDataPassOverviewModel(model);
this._perDataPassOverviewModel.bubbleTo(this);
this._perSimulationPassOverviewModel = new RunsPerSimulationPassOverviewModel(model);
this._perSimulationPassOverviewModel.bubbleTo(this);
}
/**
* Load runs overview data
* @return {void}
*/
loadOverview() {
if (! this._overviewModel.pagination.isInfiniteScrollEnabled) {
this._overviewModel.load();
}
}
/**
* Returns the model for the overview page
* @return {RunsOverviewModel} the overview model
*/
get overviewModel() {
return this._overviewModel;
}
/**
* Load the details page for the given run
* @param {object} params the parameters for the model
* @param {string} [params.runNumber = null] the runNumber of the run to display
* @param {string} [params.id = null] Usage of this parameter is deprecated, use runNumber if feasible,
* @param {string} [params.panel = null] the key of the panel to display
* @return {void}
*/
loadDetails({ runNumber = null, id: runId = null, panel: panelKey = null }) {
runId = runId ? Number(runId) : runId;
runNumber = runNumber ? Number(runNumber) : runNumber;
this._detailsModel.clearAndLoad({ runId, runNumber, panelKey });
}
/**
* Returns the run details sub model
* @return {RunDetailsModel} the sub-model
*/
get detailsModel() {
return this._detailsModel;
}
/**
* Load runs overview data
* @param {object} params the parameters for the model
* @param {string} params.lhcPeriodId id of the LHC period to display
* @param {string} params.panel key of the panel to display
* @return {void}
*/
loadPerLhcPeriodOverview({ lhcPeriodId, panel }) {
this._perLhcPeriodOverviewModel.tabbedPanelModel.currentPanelKey = panel;
if (!this._perLhcPeriodOverviewModel.pagination.isInfiniteScrollEnabled) {
this._perLhcPeriodOverviewModel.lhcPeriodId = lhcPeriodId;
this._perLhcPeriodOverviewModel.load();
}
}
/**
* Returns the model for the overview page
* @return {RunsPerLhcPeriodOverviewModel} the overview model
*/
get perLhcPeriodOverviewModel() {
return this._perLhcPeriodOverviewModel;
}
/**
* Load runs overview data
* @param {object} params the parameters for the model
* @param {string} params.dataPassId the id of the data pass to display
* @return {void}
*/
loadPerDataPassOverview({ dataPassId }) {
if (!this._perDataPassOverviewModel.pagination.isInfiniteScrollEnabled) {
this._perDataPassOverviewModel.dataPassId = parseInt(dataPassId, 10);
this._perDataPassOverviewModel.load();
}
}
/**
* Returns the model for the overview page
* @return {RunsPerDataPassOverviewModel} the overview model
*/
get perDataPassOverviewModel() {
return this._perDataPassOverviewModel;
}
/**
* Load runs overview per simulation pass data
* @param {object} params - The parameters for the model.
* @param {string} params.simulationPassId - The ID of the simulation pass to load.
* @return {void}
*/
loadPerSimulationPassOverview({ simulationPassId }) {
if (!this._perSimulationPassOverviewModel.pagination.isInfiniteScrollEnabled) {
this._perSimulationPassOverviewModel.simulationPassId = parseInt(simulationPassId, 10);
this._perSimulationPassOverviewModel.load();
}
}
/**
* Returns the model for the overview per simulation pass page
* @return {RunsPerSimulationPassOverviewModel} the overview model
*/
get perSimulationPassOverviewModel() {
return this._perSimulationPassOverviewModel;
}
}