Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
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
11 changes: 8 additions & 3 deletions app/public/components/chips/linkChip.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@ import { h } from '/js/src/index.js';
* @param {Navigation} navigation the content of the link displayed to the user
* @param {string} label displayed chip name
* @param {string} href the absolute URL targeted by the link
*
* @param {string[]|string} additionalClasses list of css classes or string of dot separated ones like .class1.class2 ...
* @return {vnode} the linkChip component
*/
export default function linkChip(navigation, label, href, additionalClasses = undefined) {
additionalClasses = !additionalClasses
? [] :
Array.isArray(additionalClasses)
? additionalClasses
: [additionalClasses];

export default function linkChip(navigation, label, href) {
return h('a.btn.chip.m1.no-text-decoration', {
return h(`${['a.btn.chip.m1.no-text-decoration', ...additionalClasses].join('.')}`, {
onclick: (e) => navigation.handleLinkEvent(e),
href: href,
}, label);
Expand Down
11 changes: 8 additions & 3 deletions app/public/views/periods/ActiveColumns/periodsActiveColumns.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const acceptableEnergyValues = RCT.mapping.energy.values;
const acceptableEnergyMargin = RCT.mapping.energy.acceptableMargin;
const fieldNames = FN.periods;

const noRelatedDataClass = 'bg-gray-light';

/**
* List of active columns for a generic periods table
*/
Expand All @@ -41,36 +43,39 @@ export const periodsActiveColumns = {
h('td',
linkChip(
navigation,
'runs',
['runs', h('sub', `[${period.runsCount}]`)],
buildHref({
page: PN.runsPerPeriod,
index: period.name,
[DRP.itemsPerPage]: navigation.model.userPreferences.itemsPerPage,
[DRP.pageNumber]: 1,
sorting: '-run_number',
}),
period.runsCount === 0 ? noRelatedDataClass : '',
),

linkChip(
navigation,
'data passes',
['data passes', h('sub', `[${period.dataPassesCount}]`)],
buildHref({
page: PN.dataPasses,
index: period.name,
[DRP.itemsPerPage]: navigation.model.userPreferences.itemsPerPage,
[DRP.pageNumber]: 1,
}),
period.dataPassesCount === 0 ? noRelatedDataClass : '',
),

linkChip(
navigation,
'MC',
['MC', h('sub', `[${period.simulationPassesCount}]`)],
buildHref({
page: PN.mc,
index: period.name,
[DRP.itemsPerPage]: navigation.model.userPreferences.itemsPerPage,
[DRP.pageNumber]: 1,
}),
period.simulationPassesCount === 0 ? noRelatedDataClass : '',
)),
],
},
Expand Down