|
| 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 | + |
| 14 | +import { Observable } from '/js/src/index.js'; |
| 15 | +import { RunsOverviewModel } from '../../Runs/Overview/RunsOverviewModel.js'; |
| 16 | +import { LogsOverviewModel } from '../../Logs/Overview/LogsOverviewModel.js'; |
| 17 | + |
| 18 | +/** |
| 19 | + * Model storing state for the home page |
| 20 | + */ |
| 21 | +export class HomePageModel extends Observable { |
| 22 | + /** |
| 23 | + * The constructor of the home model object |
| 24 | + * @param {Model} model global model |
| 25 | + */ |
| 26 | + constructor(model) { |
| 27 | + super(); |
| 28 | + this._runsOverviewModel = new RunsOverviewModel(model); |
| 29 | + this._runsOverviewModel.bubbleTo(this); |
| 30 | + |
| 31 | + this._logsOverviewModel = new LogsOverviewModel(model); |
| 32 | + this._logsOverviewModel.bubbleTo(this); |
| 33 | + } |
| 34 | + |
| 35 | + /** |
| 36 | + * Load runs and logs overview data |
| 37 | + * @return {void} |
| 38 | + */ |
| 39 | + loadOverview() { |
| 40 | + this._runsOverviewModel.fetchRuns(); |
| 41 | + this._logsOverviewModel.fetchLogs(); |
| 42 | + } |
| 43 | + |
| 44 | + /** |
| 45 | + * Returns the model for the runs overview |
| 46 | + * @return {RunsOverviewModel} the overview model |
| 47 | + */ |
| 48 | + get runsOverviewModel() { |
| 49 | + return this._runsOverviewModel; |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * Returns the model for the logs overview |
| 54 | + * @return {LogsOverviewModel} the overview model |
| 55 | + */ |
| 56 | + get logsOverviewModel() { |
| 57 | + return this._logsOverviewModel; |
| 58 | + } |
| 59 | +} |
0 commit comments