Skip to content

Commit e222334

Browse files
authored
[O2B-1162] Display all PHYSICS runs on Data Pass view (#1413)
* add constrint to use only PHYSICS runs * amend tests * cleanup * remove cond from count * remove ond on front * refactor title * add breadcrumpbs * update test * fix test * refactor * docs * rename * refactor * refactor * cleanup * refactor other places * update tests
1 parent bc988b7 commit e222334

8 files changed

Lines changed: 32 additions & 27 deletions

File tree

lib/public/components/Log/logDisplayComponent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ const logFields = () => ({
6767
name: 'Attachments',
6868
visible: true,
6969
format: (attachments) => h('span.flex-row.flex-wrap.gc1', attachments.flatMap((attachment) => [
70-
attachmentPreviewComponent(attachment),
7170
h('span.mr2', ','),
72-
]).slice(0, -1)),
71+
attachmentPreviewComponent(attachment),
72+
]).slice(1)),
7373
},
7474
});
7575

lib/public/components/environments/environmentStatusHistoryComponent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ export const environmentStatusHistoryLegendComponent = () =>
3737
* @return {Component} the resulting environment status history component
3838
*/
3939
export const environmentStatusHistoryComponent = (statusHistory) => statusHistory.flatMap((value) => [
40-
coloredEnvironmentStatusComponent(value.status, value.acronym),
4140
'-',
42-
]).slice(0, -1);
41+
coloredEnvironmentStatusComponent(value.status, value.acronym),
42+
]).slice(1);

lib/public/views/Environments/ActiveColumns/environmentsActiveColumns.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ export const environmentsActiveColumns = {
8383
size: 'w-20',
8484
format: (historyItems) => historyItems
8585
.flatMap(({ status }) => [
86-
coloredEnvironmentStatusComponent(status, STATUS_ACRONYMS[status]),
8786
'-',
88-
]).slice(0, -1),
87+
coloredEnvironmentStatusComponent(status, STATUS_ACRONYMS[status]),
88+
]).slice(1),
8989
balloon: true,
9090
},
9191
};

lib/public/views/Logs/Create/logCreationComponent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ const attachmentsPanel = (logCreationModel) => {
188188
h('#attachments-list.flex-row.flex-wrap.p2', attachments.flatMap((attachment) => {
189189
const preview = filePreviewComponent(attachment, attachment.type, attachment.name);
190190
return [
191+
h('span.mr2', ','),
191192
preview
192193
? popover(
193194
filePreviewPopoverLink(attachment.name),
@@ -203,9 +204,8 @@ const attachmentsPanel = (logCreationModel) => {
203204
},
204205
)
205206
: h('', attachment.name),
206-
h('span.mr2', ','),
207207
];
208-
}).slice(0, -1)),
208+
}).slice(1)),
209209
]);
210210
};
211211

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ export class RunsPerDataPassOverviewModel extends RunsOverviewModel {
8484
const endpint = super.getRootEndpoint();
8585
return buildUrl(endpint, { filter: {
8686
dataPassIds: [this._dataPassId],
87-
runQualities: 'good',
88-
definitions: 'PHYSICS',
8987
} });
9088
}
9189

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

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

14-
import { h } from '/js/src/index.js';
14+
import { h, iconWarning } from '/js/src/index.js';
1515
import { table } from '../../../components/common/table/table.js';
1616
import { createRunDetectorsActiveColumns } from '../ActiveColumns/runDetectorsActiveColumns.js';
1717
import { paginationComponent } from '../../../components/Pagination/paginationComponent.js';
1818
import { estimateDisplayableRowsCount } from '../../../utilities/estimateDisplayableRowsCount.js';
1919
import { exportRunsTriggerAndModal } from '../Overview/exportRunsTriggerAndModal.js';
2020
import { runsActiveColumns } from '../ActiveColumns/runsActiveColumns.js';
2121
import spinner from '../../../components/common/spinner.js';
22+
import { tooltip } from '../../../components/common/popover/tooltip.js';
23+
import { breadcrumbs } from '../../../components/common/navigation/breadcrumbs.js';
2224

2325
const TABLEROW_HEIGHT = 59;
2426
// Estimate of the navbar and pagination elements height total; Needs to be updated in case of changes;
@@ -46,14 +48,19 @@ export const RunsPerDataPassOverviewPage = ({ runs: { perDataPassOverviewModel }
4648
}), { profiles: 'runsPerDataPass' }),
4749
};
4850

51+
const commonTitle = h('h2', { style: 'white-space: nowrap;' }, 'Physics Runs');
52+
4953
return h('', [
50-
h('.flex-row.justify-between.items-center', [
51-
dataPass.match({
52-
Success: (payload) => h('h2', `Good, physics runs of ${payload.name}`),
53-
Failure: () => h('h2.danger', 'Failed to fetch Data Pass information'),
54-
Loading: () => h('.p1', spinner({ size: 2, absolute: false })),
55-
NotAsked: () => h('h2', 'Good, physics runs'),
56-
}),
54+
h('.flex-row.justify-between.items-center.g2', [
55+
h(
56+
'.flex-row.g1.items-center',
57+
dataPass.match({
58+
Success: (payload) => breadcrumbs([commonTitle, h('h2', payload.name)]),
59+
Failure: () => [commonTitle, tooltip(h('.f3', iconWarning()), 'Not able to fetch data pass info')],
60+
Loading: () => [commonTitle, spinner({ size: 2, absolute: false })],
61+
NotAsked: () => [commonTitle, tooltip(h('.f3', iconWarning()), 'No data was asked for')],
62+
}),
63+
),
5764
exportRunsTriggerAndModal(perDataPassOverviewModel, modalModel),
5865
]),
5966
h('.flex-column.w-100', [

lib/public/views/Runs/format/displayRunEorReasonOverview.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { formatEorReason } from './formatEorReason.js';
2020
* @return {Component} the display component
2121
*/
2222
export const displayRunEorReasonsOverview = (eorReasons) => eorReasons.length
23-
? eorReasons.map((eorReason) => [formatEorReason(eorReason), h('br')])
24-
.flat()
25-
.slice(0, -1)
23+
? eorReasons.flatMap((eorReason) => [h('br'), formatEorReason(eorReason)])
24+
.slice(1)
2625
: '-';

test/public/runs/runsPerDataPass.overview.test.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ module.exports = () => {
7878
expect(title).to.equal('AliceO2 Bookkeeping');
7979

8080
await page.waitForSelector('h2');
81-
const viewTitle = await page.$eval('h2', (element) => element.innerText);
82-
expect(viewTitle).to.be.eql('Good, physics runs of LHC22a_apass1');
81+
const viewTitleElements = await Promise.all((await page.$$('h2')).map((element) => element.evaluate(({ innerText }) => innerText)));
82+
expect(viewTitleElements).to.have.all.ordered.members(['Physics Runs', 'LHC22a_apass1']);
8383
});
8484

8585
it('shows correct datatypes in respective columns', async () => {
@@ -126,8 +126,8 @@ module.exports = () => {
126126
await reloadPage(page);
127127

128128
expect(await page.$eval('#firstRowIndex', (element) => parseInt(element.innerText, 10))).to.equal(1);
129-
expect(await page.$eval('#lastRowIndex', (element) => parseInt(element.innerText, 10))).to.equal(3);
130-
expect(await page.$eval('#totalRowsCount', (element) => parseInt(element.innerText, 10))).to.equal(3);
129+
expect(await page.$eval('#lastRowIndex', (element) => parseInt(element.innerText, 10))).to.equal(4);
130+
expect(await page.$eval('#totalRowsCount', (element) => parseInt(element.innerText, 10))).to.equal(4);
131131
});
132132

133133
it('successfully switch to raw timestamp display', async () => {
@@ -158,7 +158,7 @@ module.exports = () => {
158158

159159
// Expect the amount of visible runs to reduce when the first option (5) is selected
160160
const tableRows = await page.$$('table tr');
161-
expect(tableRows.length - 1).to.equal(3);
161+
expect(tableRows.length - 1).to.equal(4);
162162

163163
// Expect the custom per page input to have red border and text color if wrong value typed
164164
const customPerPageInput = await page.$(`${amountSelectorId} input[type=number]`);
@@ -242,8 +242,9 @@ module.exports = () => {
242242
expect(downloadFilesNames.filter((name) => name == targetFileName)).to.be.lengthOf(1);
243243
const runs = JSON.parse(fs.readFileSync(path.resolve(downloadPath, targetFileName)));
244244

245-
expect(runs).to.be.lengthOf(3);
245+
expect(runs).to.be.lengthOf(4);
246246
expect(runs).to.have.deep.all.members([
247+
{ runNumber: 105, runQuality: 'test' },
247248
{ runNumber: 56, runQuality: 'good' },
248249
{ runNumber: 54, runQuality: 'good' },
249250
{ runNumber: 49, runQuality: 'good' },

0 commit comments

Comments
 (0)