If there is no cron jobs running, run migrations for boards that have not been opened yet.

Thanks to xet7 !
This commit is contained in:
Lauri Ojansivu 2025-10-11 20:33:31 +03:00
parent a990109f43
commit 317138ab72
8 changed files with 1472 additions and 39 deletions

View file

@ -619,6 +619,64 @@
letter-spacing: 0.5px;
}
.system-resources {
background: #f8f9fa;
padding: 20px;
border-radius: 8px;
margin-bottom: 30px;
border-left: 4px solid #28a745;
}
.resource-item {
display: flex;
align-items: center;
margin-bottom: 15px;
}
.resource-item:last-child {
margin-bottom: 0;
}
.resource-label {
min-width: 120px;
font-weight: 600;
color: #333;
font-size: 14px;
}
.resource-bar {
flex: 1;
height: 12px;
background-color: #e0e0e0;
border-radius: 6px;
overflow: hidden;
margin: 0 15px;
position: relative;
}
.resource-fill {
height: 100%;
border-radius: 6px;
transition: width 0.3s ease;
position: relative;
}
.resource-item:nth-child(1) .resource-fill {
background: linear-gradient(90deg, #28a745, #20c997);
}
.resource-item:nth-child(2) .resource-fill {
background: linear-gradient(90deg, #007bff, #6f42c1);
}
.resource-value {
min-width: 50px;
text-align: right;
font-weight: 600;
color: #333;
font-size: 14px;
}
.board-operations-search {
margin-bottom: 30px;
}

View file

@ -107,6 +107,9 @@ template(name="cronBoardOperations")
button.btn.btn-primary.js-start-test-operation
i.fa.fa-play
| {{_ 'start-test-operation'}}
button.btn.btn-info.js-force-board-scan
i.fa.fa-search
| {{_ 'force-board-scan'}}
.board-operations-stats
.stats-grid
@ -122,6 +125,33 @@ template(name="cronBoardOperations")
.stat-item
.stat-value {{operationStats.error}}
.stat-label {{_ 'errors'}}
.stat-item
.stat-value {{queueStats.pending}}
.stat-label {{_ 'pending'}}
.stat-item
.stat-value {{queueStats.maxConcurrent}}
.stat-label {{_ 'max-concurrent'}}
.stat-item
.stat-value {{boardMigrationStats.unmigratedCount}}
.stat-label {{_ 'unmigrated-boards'}}
.stat-item
.stat-value {{boardMigrationStats.isScanning}}
.stat-label {{_ 'scanning-status'}}
.system-resources
.resource-item
.resource-label {{_ 'cpu-usage'}}
.resource-bar
.resource-fill(style="width: {{systemResources.cpuUsage}}%")
.resource-value {{systemResources.cpuUsage}}%
.resource-item
.resource-label {{_ 'memory-usage'}}
.resource-bar
.resource-fill(style="width: {{systemResources.memoryUsage}}%")
.resource-value {{systemResources.memoryUsage}}%
.resource-item
.resource-label {{_ 'cpu-cores'}}
.resource-value {{systemResources.cpuCores}}
.board-operations-search
.search-box

View file

@ -25,6 +25,9 @@ Template.cronSettings.onCreated(function() {
this.boardOperations = new ReactiveVar([]);
this.operationStats = new ReactiveVar({});
this.pagination = new ReactiveVar({});
this.queueStats = new ReactiveVar({});
this.systemResources = new ReactiveVar({});
this.boardMigrationStats = new ReactiveVar({});
// Load initial data
this.loadCronData();
@ -94,6 +97,18 @@ Template.cronSettings.helpers({
return Template.instance().pagination.get();
},
queueStats() {
return Template.instance().queueStats.get();
},
systemResources() {
return Template.instance().systemResources.get();
},
boardMigrationStats() {
return Template.instance().boardMigrationStats.get();
},
formatDateTime(date) {
if (!date) return '-';
return new Date(date).toLocaleString();
@ -365,6 +380,20 @@ Template.cronSettings.events({
const operationId = $(event.currentTarget).data('operation');
// Implementation for viewing operation details
console.log('View details for operation:', operationId);
},
'click .js-force-board-scan'(event) {
event.preventDefault();
Meteor.call('cron.forceBoardMigrationScan', (error, result) => {
if (error) {
console.error('Failed to force board scan:', error);
alert('Failed to force board scan: ' + error.message);
} else {
console.log('Board scan started successfully');
// Refresh the data
Template.instance().loadBoardOperations();
}
});
}
});
@ -424,6 +453,27 @@ Template.cronSettings.prototype.loadBoardOperations = function() {
instance.operationStats.set(result);
}
});
// Load queue stats
Meteor.call('cron.getQueueStats', (error, result) => {
if (result) {
instance.queueStats.set(result);
}
});
// Load system resources
Meteor.call('cron.getSystemResources', (error, result) => {
if (result) {
instance.systemResources.set(result);
}
});
// Load board migration stats
Meteor.call('cron.getBoardMigrationStats', (error, result) => {
if (result) {
instance.boardMigrationStats.set(result);
}
});
};
Template.cronSettings.prototype.pollMigrationProgress = function() {