Skip to content

Commit 68ce7ca

Browse files
rcourtmanclaude
andcommitted
feat: enhance data fetching and update documentation
- Improve server data fetching capabilities - Update README with latest features and instructions - Enhance data processing for backup visualization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8de0d47 commit 68ce7ca

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ Optional variables:
293293
- `PROXMOX_NODE_NAME`: A display name for this endpoint in the UI (defaults to `PROXMOX_HOST`).
294294
- `PROXMOX_ALLOW_SELF_SIGNED_CERTS`: Set to `true` if your Proxmox server uses self-signed SSL certificates. Defaults to `false`.
295295
- `PORT`: Port for the Pulse server to listen on. Defaults to `7655`.
296+
- `BACKUP_HISTORY_DAYS`: Number of days of backup history to display (defaults to `365` for full year calendar view).
296297
- *(Username/Password fallback exists but API Token is strongly recommended)*
297298
298299
#### Alert System Configuration (Optional)

server/dataFetcher.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,9 @@ async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
364364
let allBackupTasks = [];
365365
let deduplicationFactor = null;
366366

367-
// Calculate 30-day cutoff timestamp
368-
const thirtyDaysAgo = Math.floor((Date.now() - 30 * 24 * 60 * 60 * 1000) / 1000);
367+
// Calculate cutoff timestamp - default to 365 days for calendar view
368+
const backupHistoryDays = parseInt(process.env.BACKUP_HISTORY_DAYS || '365');
369+
const thirtyDaysAgo = Math.floor((Date.now() - backupHistoryDays * 24 * 60 * 60 * 1000) / 1000);
369370

370371
// Track backup runs by date and guest to avoid counting multiple snapshots per day
371372
// Use a more comprehensive key to prevent any duplicates
@@ -390,7 +391,7 @@ async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
390391
const groupsResponse = await client.get(`/admin/datastore/${datastore.name}/groups`);
391392
const groups = groupsResponse.data?.data || [];
392393

393-
// For each backup group, get recent snapshots (30 days only)
394+
// For each backup group, get snapshots within history period
394395
for (const group of groups) {
395396
try {
396397
const snapshotsResponse = await client.get(`/admin/datastore/${datastore.name}/snapshots`, {
@@ -401,7 +402,7 @@ async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
401402
});
402403
const allSnapshots = snapshotsResponse.data?.data || [];
403404

404-
// Filter snapshots to last 30 days only
405+
// Filter snapshots to configured history period
405406
const recentSnapshots = allSnapshots.filter(snapshot => {
406407
return snapshot['backup-time'] >= thirtyDaysAgo;
407408
});
@@ -477,7 +478,7 @@ async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
477478
});
478479
const allAdminTasks = response.data?.data || [];
479480

480-
// Filter admin tasks to last 30 days
481+
// Filter admin tasks to configured history period
481482
const recentAdminTasks = allAdminTasks.filter(task => task.starttime >= thirtyDaysAgo);
482483

483484
// Separate real backup tasks (for enhancement only) from other admin tasks
@@ -600,10 +601,11 @@ async function fetchPveBackupTasks(apiClient, endpointId, nodeName) {
600601
});
601602
const tasks = response.data?.data || [];
602603

603-
// Calculate 30-day cutoff timestamp
604-
const thirtyDaysAgo = Math.floor((Date.now() - 30 * 24 * 60 * 60 * 1000) / 1000);
604+
// Calculate cutoff timestamp - default to 365 days for calendar view
605+
const backupHistoryDays = parseInt(process.env.BACKUP_HISTORY_DAYS || '365');
606+
const thirtyDaysAgo = Math.floor((Date.now() - backupHistoryDays * 24 * 60 * 60 * 1000) / 1000);
605607

606-
// Filter to last 30 days and transform to match PBS backup task format
608+
// Filter to configured history period and transform to match PBS backup task format
607609
return tasks
608610
.filter(task => task.starttime >= thirtyDaysAgo)
609611
.map(task => {

0 commit comments

Comments
 (0)