Repository navigation
Expand file tree
/
Copy pathview.js
More file actions
110 lines (103 loc) · 3.96 KB
/
Copy pathview.js
File metadata and controls
110 lines (103 loc) · 3.96 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
/**
* @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.
*/
import { h, notification } from '/js/src/index.js';
import tableFilters from './logFilter/tableFilters.js';
import commandFilters from './logFilter/commandFilters.js';
import { commandLogs } from './log/commandLogs.js';
import statusBar from './log/statusBar.js';
import inspector from './log/inspector.js';
import tableLogsHeader from './log/tableLogsHeader.js';
import tableLogsContent from './log/tableLogsContent.js';
import tableLogsScrollMap from './log/tableLogsScrollMap.js';
import aboutComponent from './about/about.component.js';
import errorComponent from './common/errorComponent.js';
import { cellContextMenu } from './log/cellContextMenu.js';
import { setBrowserTabTitle } from './common/utils.js';
import { MODE } from './constants/mode.const.js';
const BROWSER_TAB_TITLE_BY_MODE = {
[MODE.QUERY]: 'QUERY',
[MODE.LIVE.RUNNING]: 'LIVE',
[MODE.LIVE.PAUSED]: 'LIVE PAUSED',
};
/**
* Given a frameworkInfo and the active mode, it will update the browser tab title accordingly
* @param {RemoteData} frameworkInfo - the framework information
* @param {string} activeMode - the current mode of the application
* @returns {void}
*/
function updateBrowserTabTitle(frameworkInfo, activeMode) {
const instanceName = frameworkInfo.isSuccess()
? (frameworkInfo.payload['infoLogger-gui'].name || '').trim()
: '';
const prefix = instanceName ? `ILG - ${instanceName}` : 'ILG';
setBrowserTabTitle(`${prefix} ${BROWSER_TAB_TITLE_BY_MODE[activeMode]}`);
}
/**
* Main view of the application
* @param {Model} model - root model of the application
* @returns {vnode[]} - the view of the application
*/
export default (model) => [
notification(model.notification),
cellContextMenu(model),
h(
'.flex-column absolute-fill',
{
oncreate: () => updateBrowserTabTitle(model.frameworkInfo, model.log.activeMode),
onupdate: () => updateBrowserTabTitle(model.frameworkInfo, model.log.activeMode),
},
[
h('.shadow-level2', [
h('header.p1.flex-row.f7.g1.justify-between', [
h('.flex-row.g3', commandLogs(model)),
h('.flex-row.g3', commandFilters(model)),
]),
h('header.f7', tableFilters(model)),
]),
h('.flex-grow.flex-row.shadow-level0.logs-container', [
aboutComponent(model),
logsTable(model),
inspectorSide(model),
]),
h('footer.f7.ph1', [statusBar(model)]),
],
),
];
/**
* Component which will display a virtual table containing the logs filtered by the user
* @param {Model} model - root model of the application
* @returns {vnode} - the virtual table containing the logs
*/
const logsTable = (model) =>
h('main.flex-grow.flex-column.transition-background-color', {
className: model.log.queryResult.isLoading() ? 'bg-gray' : '',
}, [
// table fixed header
tableLogsHeader(model),
// table scrollable content
model.log.queryResult.isFailure()
? errorComponent(model.log.queryResult.payload)
: h('.flex-row.flex-grow.logs-content', [
tableLogsContent(model),
tableLogsScrollMap(model),
]),
]);
/**
* Component which will display information about the log selected by the user
* @param {Model} model - root model of the application
* @returns {vnode} - the inspector component
*/
const inspectorSide = (model) => h('aside.sidebar', {
style: { width: model.inspectorEnabled ? '' : '0rem' },
}, [h('.sidebar-content.scroll-y#inspector-sidebar', [inspector(model)])]);