add today view route and template
This commit is contained in:
parent
0b4d7238af
commit
bfacb5b62c
5 changed files with 60 additions and 1 deletions
33
public/js/today.js
Normal file
33
public/js/today.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const scheduledNodesList = document.getElementById(
|
||||
'scheduled-nodes-list'
|
||||
);
|
||||
|
||||
function todayDateString() {
|
||||
const today = new Date();
|
||||
const year = today.getFullYear();
|
||||
const month = String(today.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(today.getDate()).padStart(2, '0');
|
||||
return year + '-' + month + '-' + day;
|
||||
}
|
||||
|
||||
async function loadScheduledNodes() {
|
||||
const date = todayDateString();
|
||||
const response = await fetch(
|
||||
'/api/scheduled-nodes?date=' + date,
|
||||
{ credentials: 'same-origin' }
|
||||
);
|
||||
if (!response.ok) {
|
||||
return;
|
||||
}
|
||||
const scheduledNodes = await response.json();
|
||||
scheduledNodesList.innerHTML = scheduledNodes
|
||||
.map((scheduledNode) =>
|
||||
'<li>' + scheduledNode.planName + ': ' +
|
||||
scheduledNode.nodeTitle + '</li>'
|
||||
)
|
||||
.join('');
|
||||
}
|
||||
|
||||
loadScheduledNodes();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue