Skip to content

Commit 7772bed

Browse files
authored
[O2B-1291] Freeze Run Number column (#1932)
* a * add CSS * abstraction * change alpha
1 parent b3a0d86 commit 7772bed

8 files changed

Lines changed: 79 additions & 15 deletions

File tree

lib/public/app.css

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ html, body {
158158

159159
.table-hover tbody tr:hover {
160160
color: #212529;
161-
background-color: rgba(0, 0, 0, 0.075);
161+
--hover-background: rgb(235, 235, 235);
162+
background-color: var(--hover-background);
162163
}
163164

164165
th.text-center, td.text-center {
@@ -169,6 +170,43 @@ th.text-center, td.text-center {
169170
max-height: 3rem;
170171
}
171172

173+
174+
/* sticky first column when horizontal scrolling */
175+
.freeze-first-column th:first-child {
176+
background: var(--color-gray-light);
177+
position: sticky;
178+
left: 0;
179+
z-index: 2;
180+
}
181+
182+
.freeze-first-column td:first-child {
183+
background: inherit;
184+
position: sticky;
185+
left: 0;
186+
z-index: 2;
187+
}
188+
189+
.freeze-first-column td:first-child::after {
190+
content: "";
191+
position: absolute;
192+
top: 0;
193+
right: 0;
194+
width: 1px;
195+
height: 100%;
196+
background-color: var(--color-gray-light);
197+
}
198+
199+
.freeze-first-column th:first-child::after {
200+
content: "";
201+
position: absolute;
202+
top: 0;
203+
right: 0;
204+
width: 1px;
205+
height: 100%;
206+
background-color: var(--color-gray);
207+
}
208+
209+
172210
/* alerts */
173211

174212
.alert {

lib/public/components/common/table/table.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export const table = (
126126
}
127127

128128
// Extract the profile of the table
129-
const { profile: currentProfile = profiles.none, horizontalScrollEnabled = false } = tableConfiguration || {};
129+
const { profile: currentProfile = profiles.none, horizontalScrollEnabled = false, freezeFirstColumn = false } = tableConfiguration || {};
130130
const { idKey, displayedColumns } = parseColumnsConfiguration(columns, currentProfile);
131131

132132
let remoteData;
@@ -139,7 +139,7 @@ export const table = (
139139
}
140140

141141
return h(`${horizontalScrollEnabled ? '.scroll-auto.shadow-level1' : ''}`, h(
142-
'table.table.table-hover.shadow-level1.no-z-index',
142+
`table.table.table-hover.shadow-level1.no-z-index${freezeFirstColumn ? '.freeze-first-column' : ''}`,
143143
{
144144
style: `table-layout: ${horizontalScrollEnabled ? 'auto' : 'fixed'}`,
145145
},

lib/public/models/OverviewModel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export class OverviewPageModel extends Observable {
6464
*/
6565
this._displayOptions = new ObservableData({
6666
horizontalScrollEnabled: false,
67+
freezeFirstColumn: false,
6768
});
6869
}
6970

lib/public/views/Runs/Overview/FixedPdpBeamTypeRunsOverviewModel.js

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

14-
import { RunsOverviewModel } from './RunsOverviewModel.js';
14+
import { RunsWithQcModel } from './RunsWithQcModel.js';
1515

1616
/**
1717
* FixedPdpBeamTypeRunsOverviewModel
1818
*
1919
* Runs overview model which stores information about pdp_beam_type,
2020
* which is supposed to be the same for all runs stored in this model
2121
*/
22-
export class FixedPdpBeamTypeRunsOverviewModel extends RunsOverviewModel {
22+
export class FixedPdpBeamTypeRunsOverviewModel extends RunsWithQcModel {
2323
/**
2424
* Constructor
2525
* @param {Model} model global model
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 { RunsOverviewModel } from './RunsOverviewModel.js';
15+
16+
/**
17+
* RunsWithQcModel
18+
*
19+
* Runs overview model which stores common information for all RCT runs overviews pages
20+
*/
21+
export class RunsWithQcModel extends RunsOverviewModel {
22+
/**
23+
* Constructor
24+
* @param {Model} model global model
25+
*/
26+
constructor(model) {
27+
super(model);
28+
29+
this.patchDisplayOptions({ horizontalScrollEnabled: true, freezeFirstColumn: true });
30+
}
31+
}

lib/public/views/Runs/RunPerDataPass/RunsPerDataPassOverviewModel.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ export class RunsPerDataPassOverviewModel extends FixedPdpBeamTypeRunsOverviewMo
6565

6666
this._discardAllQcFlagsActionState$ = new ObservableData(RemoteData.notAsked());
6767
this._discardAllQcFlagsActionState$.bubbleTo(this);
68-
69-
this.patchDisplayOptions({ horizontalScrollEnabled: true });
7068
}
7169

7270
/**

lib/public/views/Runs/RunPerPeriod/RunsPerLhcPeriodOverviewModel.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import { buildUrl, RemoteData } from '/js/src/index.js';
1414
import { TabbedPanelModel } from '../../../components/TabbedPanel/TabbedPanelModel.js';
1515
import { detectorsProvider } from '../../../services/detectors/detectorsProvider.js';
16-
import { RunsOverviewModel } from '../Overview/RunsOverviewModel.js';
16+
import { RunsWithQcModel } from '../Overview/RunsWithQcModel.js';
1717
import { jsonFetch } from '../../../utilities/fetch/jsonFetch.js';
1818

1919
export const RUNS_PER_LHC_PERIOD_PANELS_KEYS = {
@@ -24,7 +24,7 @@ export const RUNS_PER_LHC_PERIOD_PANELS_KEYS = {
2424
/**
2525
* Runs Per LHC Period overview model
2626
*/
27-
export class RunsPerLhcPeriodOverviewModel extends RunsOverviewModel {
27+
export class RunsPerLhcPeriodOverviewModel extends RunsWithQcModel {
2828
/**
2929
* Constructor
3030
*
@@ -35,8 +35,6 @@ export class RunsPerLhcPeriodOverviewModel extends RunsOverviewModel {
3535
this._detectors$ = detectorsProvider.physical$;
3636
this._detectors$.bubbleTo(this);
3737

38-
this.patchDisplayOptions({ horizontalScrollEnabled: true });
39-
4038
this._tabbedPanelModel = new RunsPerLhcPeriodTabbedPanelModel();
4139
this._tabbedPanelModel.bubbleTo(this);
4240
}

lib/public/views/Runs/RunsPerSimulationPass/RunsPerSimulationPassOverviewModel.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* or submit itself to any jurisdiction.
1212
*/
1313
import { buildUrl, RemoteData } from '/js/src/index.js';
14-
import { RunsOverviewModel } from '../Overview/RunsOverviewModel.js';
14+
import { RunsWithQcModel } from '../Overview/RunsWithQcModel.js';
1515
import { ObservableData } from '../../../utilities/ObservableData.js';
1616
import { getRemoteData } from '../../../utilities/fetch/getRemoteData.js';
1717
import { detectorsProvider } from '../../../services/detectors/detectorsProvider.js';
@@ -20,7 +20,7 @@ import { RunDetectorsSelectionModel } from '../RunDetectorsSelectionModel.js';
2020
/**
2121
* Runs Per Simulation Pass overview model
2222
*/
23-
export class RunsPerSimulationPassOverviewModel extends RunsOverviewModel {
23+
export class RunsPerSimulationPassOverviewModel extends RunsWithQcModel {
2424
/**
2525
* Constructor
2626
* @param {Model} model global model
@@ -36,8 +36,6 @@ export class RunsPerSimulationPassOverviewModel extends RunsOverviewModel {
3636

3737
this._runDetectorsSelectionModel = new RunDetectorsSelectionModel();
3838
this._runDetectorsSelectionModel.bubbleTo(this);
39-
40-
this.patchDisplayOptions({ horizontalScrollEnabled: true });
4139
}
4240

4341
/**

0 commit comments

Comments
 (0)