Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[O2B-1162] Display all PHYSICS runs on Data Pass view #1413

Merged
merged 22 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/public/components/Log/logDisplayComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ const logFields = () => ({
name: 'Attachments',
visible: true,
format: (attachments) => h('span.flex-row.flex-wrap.gc1', attachments.flatMap((attachment) => [
attachmentPreviewComponent(attachment),
h('span.mr2', ','),
]).slice(0, -1)),
attachmentPreviewComponent(attachment),
]).slice(1)),
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ export const environmentStatusHistoryLegendComponent = () =>
* @return {Component} the resulting environment status history component
*/
export const environmentStatusHistoryComponent = (statusHistory) => statusHistory.flatMap((value) => [
coloredEnvironmentStatusComponent(value.status, value.acronym),
'-',
]).slice(0, -1);
coloredEnvironmentStatusComponent(value.status, value.acronym),
]).slice(1);
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ export const environmentsActiveColumns = {
size: 'w-20',
format: (historyItems) => historyItems
.flatMap(({ status }) => [
coloredEnvironmentStatusComponent(status, STATUS_ACRONYMS[status]),
'-',
]).slice(0, -1),
coloredEnvironmentStatusComponent(status, STATUS_ACRONYMS[status]),
]).slice(1),
balloon: true,
},
};
4 changes: 2 additions & 2 deletions lib/public/views/Logs/Create/logCreationComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ const attachmentsPanel = (logCreationModel) => {
h('#attachments-list.flex-row.flex-wrap.p2', attachments.flatMap((attachment) => {
const preview = filePreviewComponent(attachment, attachment.type, attachment.name);
return [
h('span.mr2', ','),
preview
? popover(
filePreviewPopoverLink(attachment.name),
Expand All @@ -203,9 +204,8 @@ const attachmentsPanel = (logCreationModel) => {
},
)
: h('', attachment.name),
h('span.mr2', ','),
];
}).slice(0, -1)),
}).slice(1)),
]);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ export class RunsPerDataPassOverviewModel extends RunsOverviewModel {
const endpint = super.getRootEndpoint();
return buildUrl(endpint, { filter: {
dataPassIds: [this._dataPassId],
runQualities: 'good',
definitions: 'PHYSICS',
} });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@
* or submit itself to any jurisdiction.
*/

import { h } from '/js/src/index.js';
import { h, iconWarning } from '/js/src/index.js';
import { table } from '../../../components/common/table/table.js';
import { createRunDetectorsActiveColumns } from '../ActiveColumns/runDetectorsActiveColumns.js';
import { paginationComponent } from '../../../components/Pagination/paginationComponent.js';
import { estimateDisplayableRowsCount } from '../../../utilities/estimateDisplayableRowsCount.js';
import { exportRunsTriggerAndModal } from '../Overview/exportRunsTriggerAndModal.js';
import { runsActiveColumns } from '../ActiveColumns/runsActiveColumns.js';
import spinner from '../../../components/common/spinner.js';
import { tooltip } from '../../../components/common/popover/tooltip.js';
import { breadcrumbs } from '../../../components/common/navigation/breadcrumbs.js';

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

const commonTitle = h('h2', { style: 'white-space: nowrap;' }, 'Physics Runs');

return h('', [
h('.flex-row.justify-between.items-center', [
dataPass.match({
Success: (payload) => h('h2', `Good, physics runs of ${payload.name}`),
Failure: () => h('h2.danger', 'Failed to fetch Data Pass information'),
Loading: () => h('.p1', spinner({ size: 2, absolute: false })),
NotAsked: () => h('h2', 'Good, physics runs'),
}),
h('.flex-row.justify-between.items-center.g2', [
h(
'.flex-row.g1.items-center',
dataPass.match({
Success: (payload) => breadcrumbs([commonTitle, h('h2', payload.name)]),
Failure: () => [commonTitle, tooltip(h('.f3', iconWarning()), 'Not able to fetch data pass info')],
Loading: () => [commonTitle, spinner({ size: 2, absolute: false })],
NotAsked: () => [commonTitle, tooltip(h('.f3', iconWarning()), 'No data was asked for')],
}),
),
exportRunsTriggerAndModal(perDataPassOverviewModel, modalModel),
]),
h('.flex-column.w-100', [
Expand Down
5 changes: 2 additions & 3 deletions lib/public/views/Runs/format/displayRunEorReasonOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { formatEorReason } from './formatEorReason.js';
* @return {Component} the display component
*/
export const displayRunEorReasonsOverview = (eorReasons) => eorReasons.length
? eorReasons.map((eorReason) => [formatEorReason(eorReason), h('br')])
.flat()
.slice(0, -1)
? eorReasons.flatMap((eorReason) => [h('br'), formatEorReason(eorReason)])
.slice(1)
: '-';
13 changes: 7 additions & 6 deletions test/public/runs/runsPerDataPass.overview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ module.exports = () => {
expect(title).to.equal('AliceO2 Bookkeeping');

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

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

expect(await page.$eval('#firstRowIndex', (element) => parseInt(element.innerText, 10))).to.equal(1);
expect(await page.$eval('#lastRowIndex', (element) => parseInt(element.innerText, 10))).to.equal(3);
expect(await page.$eval('#totalRowsCount', (element) => parseInt(element.innerText, 10))).to.equal(3);
expect(await page.$eval('#lastRowIndex', (element) => parseInt(element.innerText, 10))).to.equal(4);
expect(await page.$eval('#totalRowsCount', (element) => parseInt(element.innerText, 10))).to.equal(4);
});

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

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

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

expect(runs).to.be.lengthOf(3);
expect(runs).to.be.lengthOf(4);
expect(runs).to.have.deep.all.members([
{ runNumber: 105, runQuality: 'test' },
{ runNumber: 56, runQuality: 'good' },
{ runNumber: 54, runQuality: 'good' },
{ runNumber: 49, runQuality: 'good' },
Expand Down