3 const th
= require('./template-helper');
5 function renderAlmanacRow(entry
) {
6 const { event
, date
} = entry
;
9 \t<td>${th.timeElement(date, { title: 'Occurred' })}</td>
13 function almanacSection(almanac
) {
22 ${almanac.map((entry) => renderAlmanacRow(entry)).join('\n')}
28 function renderChoreRow(choreName
, choreDetails
) {
29 const { intervalMs
, nextSchedule
} = choreDetails
;
31 \t<td>${choreName}</td>
32 \t<td>${th.secondsToPeriod(Math.ceil(intervalMs / 1000))}</td>
33 \t<td>${th.timeElement(nextSchedule)}</td>
37 function choresSection(chores
) {
43 \t\t\t<th>Frequency</th>
44 \t\t\t<th>Next Run</th>
47 ${Object.entries(chores).map((chore) => renderChoreRow(...chore)).join('\n')}
56 * @param {Object[]} ctx.almanac
57 * @param {Object} ctx.chores
58 * @param {Object} options
59 * @param {Object} options.manager
60 * @param {String} options.manager.pageTitle
61 * @param {String[]} options.manager.footerEntries
62 * @param {String} options.adminContactHTML
65 module
.exports
= (ctx
, options
) => {
67 pageTitle: options
.manager
.pageTitle
+ ' - Maintenance',
68 logoUrl: options
.manager
.logoUrl
,
69 footerEntries: options
.manager
.footerEntries
,
82 almanacSection(ctx
.almanac
|| []),
83 choresSection(ctx
.chores
|| {}),
85 return th
.htmlPage(1, ctx
, htmlOptions
, content
);