Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit daa23df

Browse files
authored
Merge pull request #70 from AliceO2Group/ui-improvement
UI improvement part 4
2 parents 2ba66b8 + 7fb0f79 commit daa23df

12 files changed

Lines changed: 569 additions & 972 deletions

File tree

app/public/Model.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ export default class Model extends Observable {
2222
super();
2323

2424
this.session = sessionService.get();
25-
this.session.personid = parseInt(this.session.personid, 10); // cast, sessionService has only strings
25+
this.session.personid = parseInt(this.session.personid, 10); // Cast, sessionService has only strings
2626
// TODO if no personid then it is a computer so we need to parse it respectively
2727
this.session.roles = this.getRoles();
28-
28+
2929
this.router = new QueryRouter();
3030
this.router.bubbleTo(this);
3131
this.loader = new Loader();
@@ -59,19 +59,19 @@ export default class Model extends Observable {
5959

6060
getRoles() {
6161
if (this.session.access.includes(ROLES.Admin)) {
62-
return [ ROLES.Admin ];
62+
return [ROLES.Admin];
6363
} else if (this.session.access.includes(ROLES.Global)) {
64-
return [ ROLES.Global ];
64+
return [ROLES.Global];
6565
} else if (this.session.access.some((role) => this.isDetectorRole(role))) {
6666
const roles = [];
67-
Object.values(ROLES).filter(role => this.isDetectorRole(role)).forEach((detectorRole) => {
67+
Object.values(ROLES).filter((role) => this.isDetectorRole(role)).forEach((detectorRole) => {
6868
if (this.session.access.includes(detectorRole)) {
6969
roles.push(detectorRole);
7070
}
7171
});
7272
return roles;
7373
}
74-
return [ ROLES.Guest ];
74+
return [ROLES.Guest];
7575
}
7676

7777
setServiceUnavailable(result) {

app/public/components/common/header.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ const functionalities = (model) => h('.button-group.text-right',
6464
}, iconDataTransferDownload()),
6565

6666
h('button.btn.filter-button', {
67-
className: model.searchFieldsVisible ? 'active' : '',
67+
className: model.searchFieldsVisible ? 'selected' : '',
6868
onclick: () => model.changeSearchFieldsVisibility(),
6969
}, h('.filter-20.icon')));

app/public/components/userView/data/headersSpecials.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const headersSpecials = {
5555
name: 'Name',
5656
year: 'Year',
5757
beam: 'Beam type',
58-
energy: 'Energy [GeV]',
58+
energy: 'Mean energy [GeV]',
5959
},
6060
runsPerPeriod: runsViews,
6161
mc: mcViews,
@@ -86,4 +86,12 @@ export const getHeaderSpecial = (model, f) => {
8686
}
8787
};
8888

89-
export const headerSpecPresent = (model, f) => Boolean(headersSpecials[model.getCurrentDataPointer().page][f.name]);
89+
export const filterApplicableHeader = 'filterApplicableHeader';
90+
export const filterNonApplicableHeader = 'filterNonApplicableHeader';
91+
export const nonDisplayable = 'nonDisplayable';
92+
93+
export const headerSpecPresent = (model, f) => headersSpecials[model.getCurrentDataPointer().page][f.name]
94+
? filterApplicableHeader
95+
: /.*detector/.test(f.name)
96+
? filterNonApplicableHeader
97+
: nonDisplayable;

app/public/components/userView/data/table/header.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414

1515
import { h } from '/js/src/index.js';
16-
import { getHeaderSpecial, headerSpecPresent } from '../headersSpecials.js';
16+
import { filterApplicableHeader, getHeaderSpecial, headerSpecPresent, nonDisplayable } from '../headersSpecials.js';
1717
import { sort } from '../../../../utils/sort.js';
1818

1919
export default function tableHeader(visibleFields, data, model) {
@@ -25,22 +25,24 @@ const columnsHeadersArray = (visibleFields, data, model) =>
2525
visibleFields.map((f) => h(`th.${model.getCurrentDataPointer().page}-${f.name}-header`, {
2626
scope: 'col',
2727
}, h('.relative', [
28-
headerSpecPresent(model, f) ? [
28+
headerSpecPresent(model, f) !== nonDisplayable ? [
2929
h('.inline', getHeaderSpecial(model, f)),
30-
h('.inline',
31-
h('.vertical-center',
32-
h('div.sort-up-20', {
33-
onclick: () => sort(f.name, data, model, -1),
34-
class: data.sorting.order === -1 && data.sorting.field === f.name
35-
? 'selected' :
36-
'',
37-
}),
38-
h('div.sort-down-20', {
39-
onclick: () => sort(f.name, data, model, 1),
40-
class: data.sorting.order === 1 && data.sorting.field === f.name
41-
? 'selected'
42-
: '',
43-
}))),
30+
headerSpecPresent(model, f) === filterApplicableHeader
31+
? h('.inline',
32+
h('.vertical-center',
33+
h('div.sort-up-20.pointer', {
34+
onclick: () => sort(f.name, data, model, -1),
35+
class: data.sorting.order === -1 && data.sorting.field === f.name
36+
? 'selected' :
37+
'',
38+
}),
39+
h('div.sort-down-20.pointer', {
40+
onclick: () => sort(f.name, data, model, 1),
41+
class: data.sorting.order === 1 && data.sorting.field === f.name
42+
? 'selected'
43+
: '',
44+
})))
45+
: '',
4446
] : '',
4547
])));
4648

app/public/styles/custom.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,11 @@
213213
background-color: #577590 !important;
214214
}
215215

216-
.btn:active {
217-
background-color: #577590 !important;
216+
.btn.selected {
217+
background-color: var(--color-gray-dark) !important;
218+
color: var(--color-white) !important;
218219
}
219220

221+
.pointer {
222+
cursor: pointer !important;
223+
}

app/public/styles/custom/tables/periods.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
text-align: right;
6969
}
7070

71-
/* Energy */
71+
/* Mean energy */
7272
.periods-table .periods-energy-cell, .periods-table .periods-energy-header {
7373
min-width: 60px;
7474
text-align: right;

app/public/styles/custom/tables/runs.css

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,40 @@
6060
text-align: right;
6161
}
6262

63+
/* Energy per beam */
64+
.runs-table .runsPerPeriod-energy_per_beam-cell, .runs-table .runsPerPeriod-energy_per_beam-header,
65+
.runs-table .runsPerDataPass-energy_per_beam-cell, .runs-table .runsPerDataPass-energy_per_beam-header {
66+
min-width: 100px;
67+
text-align: right;
68+
}
69+
70+
/* Fill number */
71+
.runs-table .runsPerPeriod-fill_number-cell, .runs-table .runsPerPeriod-fill_number-header,
72+
.runs-table .runsPerDataPass-fill_number-cell, .runs-table .runsPerDataPass-fill_number-header {
73+
min-width: 100px;
74+
text-align: right;
75+
}
76+
77+
/* L3 current */
78+
.runs-table .runsPerPeriod-l3_current-cell, .runs-table .runsPerPeriod-l3_current-header,
79+
.runs-table .runsPerDataPass-l3_current-cell, .runs-table .runsPerDataPass-l3_current-header {
80+
min-width: 100px;
81+
text-align: right;
82+
}
83+
84+
/* Dipole current */
85+
.runs-table .runsPerPeriod-dipole_current-cell, .runs-table .runsPerPeriod-dipole_current-header,
86+
.runs-table .runsPerDataPass-dipole_current-cell, .runs-table .runsPerDataPass-dipole_current-header {
87+
min-width: 100px;
88+
text-align: right;
89+
}
90+
91+
/* Tof detector
92+
.runsPerPeriod-tof_detector-header {
93+
min-width: 100px;
94+
}
95+
*/
96+
6397
.runs-table td:last-child, .runs-table th:last-child {
6498
padding-right: 2em;
6599
}

app/public/views/serviceUnavailableView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import { h } from '/js/src/index.js';
1515

1616
export default function serviceUnavailablePanel(model) {
17-
let submodel = model.submodels[model.mode];
17+
const submodel = model.submodels[model.mode];
1818
const retryBtn = h('button.btn.btn-primary.m3', { onclick: () => submodel.retry() }, 'Retry');
1919
const title = h('h1.primary', 'Run Condition Table');
2020
const subtitle = h('h3', 'Service temporarily unavailable');

app/public/views/userView.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ import { h } from '/js/src/index.js';
1616
import header from '../components/common/header.js';
1717
import dataPanel from '../components/userView/data/dataPanel.js';
1818
import sidebar from '../components/userView/sidebar/sidebar.js';
19-
import { PREFIX, ROLES } from '../workflow/constants.js';
2019

2120
export default function userPanel(model) {
22-
let submodel = model.submodels[model.mode];
21+
const submodel = model.submodels[model.mode];
2322
return h('.flex-column.absolute-fill', [
2423
h('header.shadow-level2.level2', [header(submodel)]),
2524
h('.flex-grow.flex-row.outline-gray', [

app/public/workflow/constants.js

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,32 @@
1010
* In applying this license CERN does not waive the privileges and immunities
1111
* granted to it by virtue of its status as an Intergovernmental Organization
1212
* or submit itself to any jurisdiction.
13-
*/
13+
*/
1414

1515
const PREFIX = {
16-
SSO_DET_ROLE: 'det-'
16+
SSO_DET_ROLE: 'det-',
1717
};
1818

1919
const ROLES = Object.freeze({
20-
Admin: 'admin',
21-
Global: 'global',
22-
DetectorCPV: 'det-cpv',
23-
DetectorEMC: 'det-emc',
24-
DetectorFFD: 'det-fdd',
25-
DetectorFT0: 'det-ft0',
26-
DetectorFV0: 'det-fv0',
27-
DetectorGLO: 'det-glo',
28-
DetectorHMP: 'det-hmp',
29-
DetectorITS: 'det-its',
30-
DetectorMCH: 'det-mch',
31-
DetectorMFT: 'det-mft',
32-
DetectorMID: 'det-mid',
33-
DetectorPHS: 'det-phs',
34-
DetectorTOF: 'det-tof',
35-
DetectorTPC: 'det-tpc',
36-
DetectorTRD: 'det-trd',
37-
DetectorZDC: 'det-zdc',
38-
Guest: 'guest'
20+
Admin: 'admin',
21+
Global: 'global',
22+
DetectorCPV: 'det-cpv',
23+
DetectorEMC: 'det-emc',
24+
DetectorFFD: 'det-fdd',
25+
DetectorFT0: 'det-ft0',
26+
DetectorFV0: 'det-fv0',
27+
DetectorGLO: 'det-glo',
28+
DetectorHMP: 'det-hmp',
29+
DetectorITS: 'det-its',
30+
DetectorMCH: 'det-mch',
31+
DetectorMFT: 'det-mft',
32+
DetectorMID: 'det-mid',
33+
DetectorPHS: 'det-phs',
34+
DetectorTOF: 'det-tof',
35+
DetectorTPC: 'det-tpc',
36+
DetectorTRD: 'det-trd',
37+
DetectorZDC: 'det-zdc',
38+
Guest: 'guest',
3939
});
40-
41-
export {PREFIX, ROLES};
42-
40+
41+
export { PREFIX, ROLES };

0 commit comments

Comments
 (0)