many updates
This commit is contained in:
@@ -225,8 +225,8 @@
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Interval (Minutes)</label>
|
||||
<input type="number" class="form-control" id="edit-job-interval" min="1" required>
|
||||
<div class="form-text">How often this job should run.</div>
|
||||
<input type="number" class="form-control" id="edit-job-interval" min="0" required>
|
||||
<div class="form-text">How often this job should run. Set to 0 for Manual Only (Adhoc).</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Parameters (JSON)</label>
|
||||
@@ -261,13 +261,7 @@
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Job Type</label>
|
||||
<select class="form-select" id="create-job-type" onchange="updateParamsHelp()">
|
||||
<option value="fitbit_weight_sync">Fitbit Weight Sync</option>
|
||||
<option value="activity_sync">Garmin Activities Sync</option>
|
||||
<option value="metrics_sync">Garmin Metrics Sync</option>
|
||||
<option value="health_scan">Health Data Scan</option>
|
||||
<option value="health_sync_pending">Sync Pending Health</option>
|
||||
<option value="garmin_weight_upload">Upload Weight to Garmin</option>
|
||||
<option value="activity_backfill_full">Activity Backfill (Full)</option>
|
||||
<option value="" disabled selected>Loading...</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
@@ -277,7 +271,8 @@
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Interval (Minutes)</label>
|
||||
<input type="number" class="form-control" id="create-job-interval" min="1" value="60" required>
|
||||
<input type="number" class="form-control" id="create-job-interval" min="0" value="60" required>
|
||||
<div class="form-text">Set to 0 for Manual Only.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
@@ -366,6 +361,7 @@
|
||||
loadJobs();
|
||||
if (typeof updateParamsHelp === 'function') updateParamsHelp(); // Init helper text
|
||||
loadDashboardData();
|
||||
populateJobTypes();
|
||||
|
||||
// Auto-refresh dashboard data every 3 seconds
|
||||
setInterval(loadDashboardData, 3000);
|
||||
@@ -851,7 +847,7 @@
|
||||
const paramsStr = document.getElementById('create-job-params').value;
|
||||
|
||||
if (!name) { alert("Name is required"); return; }
|
||||
if (interval < 1) { alert("Interval must be > 0"); return; }
|
||||
if (interval < 0) { alert("Interval must be >= 0"); return; }
|
||||
|
||||
let params = {};
|
||||
try {
|
||||
@@ -992,8 +988,8 @@
|
||||
const enabled = document.getElementById('edit-job-enabled').checked;
|
||||
const paramsStr = document.getElementById('edit-job-params').value;
|
||||
|
||||
if (interval < 1) {
|
||||
alert("Interval must be at least 1 minute");
|
||||
if (interval < 0) {
|
||||
alert("Interval must be at least 0 minutes");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1029,5 +1025,32 @@
|
||||
alert("Error: " + e.message);
|
||||
}
|
||||
}
|
||||
async function populateJobTypes() {
|
||||
const select = document.getElementById('create-job-type');
|
||||
try {
|
||||
const response = await fetch('/api/scheduling/available-types');
|
||||
if (!response.ok) throw new Error('Failed to fetch types');
|
||||
const types = await response.json();
|
||||
|
||||
select.innerHTML = '';
|
||||
types.forEach(type => {
|
||||
const option = document.createElement('option');
|
||||
option.value = type;
|
||||
// Simple label transformation: underscores to spaces, Title Case
|
||||
option.text = type.replace(/_/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
|
||||
select.appendChild(option);
|
||||
});
|
||||
|
||||
// Trigger help update for first item
|
||||
if (types.length > 0) {
|
||||
select.selectedIndex = 0;
|
||||
updateParamsHelp();
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error("Error loading job types", e);
|
||||
select.innerHTML = '<option disabled>Error loading types</option>';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user