Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30f5ed11b8 | ||
|
|
d6a8b45357 |
@@ -2,6 +2,18 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## 2.6.27 - 2026-08-14
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Scheduled task intervals now display the most appropriate exact unit, such as seconds, minutes, hours, or days, while keeping the sort order numeric.
|
||||||
|
|
||||||
|
## 2.6.26 - 2026-08-10
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- API sources and RSS feeds now accept hours as an update interval unit, and the list and background task scheduling paths now format and convert that unit correctly.
|
||||||
|
|
||||||
## 2.6.25 - 2026-08-10
|
## 2.6.25 - 2026-08-10
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pulse-signage-player",
|
"name": "pulse-signage-player",
|
||||||
"version": "2.6.25",
|
"version": "2.6.27",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Pulse Signage player application bundle",
|
"description": "Pulse Signage player application bundle",
|
||||||
"main": "src/common.js",
|
"main": "src/common.js",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pulse-signage-web",
|
"name": "pulse-signage-web",
|
||||||
"version": "2.6.25",
|
"version": "2.6.27",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Pulse Signage web and bridge application bundle",
|
"description": "Pulse Signage web and bridge application bundle",
|
||||||
"main": "src/common.js",
|
"main": "src/common.js",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pulse-signage",
|
"name": "pulse-signage",
|
||||||
"version": "2.6.25",
|
"version": "2.6.27",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Pulse Signage application with MySQL and media storage",
|
"description": "Pulse Signage application with MySQL and media storage",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ const ITEMS_PATH_MAX_LENGTH = 255;
|
|||||||
|
|
||||||
function normalizeUpdateIntervalUnit(value) {
|
function normalizeUpdateIntervalUnit(value) {
|
||||||
const unit = String(value || '').trim().toLowerCase();
|
const unit = String(value || '').trim().toLowerCase();
|
||||||
return unit === 'seconds' ? 'seconds' : 'minutes';
|
if (unit === 'seconds' || unit === 'minutes' || unit === 'hours') {
|
||||||
|
return unit;
|
||||||
|
}
|
||||||
|
return 'minutes';
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeAuthMethod(value) {
|
function normalizeAuthMethod(value) {
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ const URL_MAX_LENGTH = 1024;
|
|||||||
|
|
||||||
function normalizeUpdateIntervalUnit(value) {
|
function normalizeUpdateIntervalUnit(value) {
|
||||||
const unit = String(value || '').trim().toLowerCase();
|
const unit = String(value || '').trim().toLowerCase();
|
||||||
return unit === 'seconds' ? 'seconds' : 'minutes';
|
if (unit === 'seconds' || unit === 'minutes' || unit === 'hours') {
|
||||||
|
return unit;
|
||||||
|
}
|
||||||
|
return 'minutes';
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchRssFeedsData(pool) {
|
async function fetchRssFeedsData(pool) {
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ function normalizeIntervalMs(value, unit) {
|
|||||||
if (normalizedUnit === 'seconds') {
|
if (normalizedUnit === 'seconds') {
|
||||||
return numericValue * 1000;
|
return numericValue * 1000;
|
||||||
}
|
}
|
||||||
|
if (normalizedUnit === 'hours') {
|
||||||
|
return numericValue * 60 * 60 * 1000;
|
||||||
|
}
|
||||||
return numericValue * 60 * 1000;
|
return numericValue * 60 * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,13 @@ function toIsoTimestamp(value) {
|
|||||||
|
|
||||||
function formatIntervalLabel(interval, unit) {
|
function formatIntervalLabel(interval, unit) {
|
||||||
const value = Math.max(1, Number(interval) || 0);
|
const value = Math.max(1, Number(interval) || 0);
|
||||||
const normalizedUnit = String(unit || 'minutes').trim().toLowerCase() === 'seconds' ? 'seconds' : 'minutes';
|
const normalizedUnit = String(unit || 'minutes').trim().toLowerCase();
|
||||||
if (normalizedUnit === 'seconds') {
|
if (normalizedUnit === 'seconds') {
|
||||||
return value === 1 ? 'Every second' : `Every ${value} seconds`;
|
return value === 1 ? 'Every second' : `Every ${value} seconds`;
|
||||||
}
|
}
|
||||||
|
if (normalizedUnit === 'hours') {
|
||||||
|
return value === 1 ? 'Every hour' : `Every ${value} hours`;
|
||||||
|
}
|
||||||
return value === 1 ? 'Every minute' : `Every ${value} minutes`;
|
return value === 1 ? 'Every minute' : `Every ${value} minutes`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ module.exports = function registerApiSourceRoutes(app, deps) {
|
|||||||
itemsPath: apiSource.items_path || '',
|
itemsPath: apiSource.items_path || '',
|
||||||
intervalLabel: apiSource.update_interval_unit === 'seconds'
|
intervalLabel: apiSource.update_interval_unit === 'seconds'
|
||||||
? (Math.max(1, Number(apiSource.update_interval_value) || 0) === 1 ? 'Every second' : `Every ${Math.max(1, Number(apiSource.update_interval_value) || 0)} seconds`)
|
? (Math.max(1, Number(apiSource.update_interval_value) || 0) === 1 ? 'Every second' : `Every ${Math.max(1, Number(apiSource.update_interval_value) || 0)} seconds`)
|
||||||
|
: apiSource.update_interval_unit === 'hours'
|
||||||
|
? (Math.max(1, Number(apiSource.update_interval_value) || 0) === 1 ? 'Every hour' : `Every ${Math.max(1, Number(apiSource.update_interval_value) || 0)} hours`)
|
||||||
: (Math.max(1, Number(apiSource.update_interval_value) || 0) === 1 ? 'Every minute' : `Every ${Math.max(1, Number(apiSource.update_interval_value) || 0)} minutes`),
|
: (Math.max(1, Number(apiSource.update_interval_value) || 0) === 1 ? 'Every minute' : `Every ${Math.max(1, Number(apiSource.update_interval_value) || 0)} minutes`),
|
||||||
lastPullLabel: apiSource.last_pulled_at ? formatDashboardDate(apiSource.last_pulled_at) : 'Never',
|
lastPullLabel: apiSource.last_pulled_at ? formatDashboardDate(apiSource.last_pulled_at) : 'Never',
|
||||||
lastPulledAtValue: apiSource.last_pulled_at ? new Date(apiSource.last_pulled_at).toISOString() : '',
|
lastPulledAtValue: apiSource.last_pulled_at ? new Date(apiSource.last_pulled_at).toISOString() : '',
|
||||||
|
|||||||
@@ -4,10 +4,13 @@ const { renderView } = require('../../../view');
|
|||||||
|
|
||||||
function formatIntervalLabel(interval, unit) {
|
function formatIntervalLabel(interval, unit) {
|
||||||
const value = Math.max(1, Number(interval) || 0);
|
const value = Math.max(1, Number(interval) || 0);
|
||||||
const normalizedUnit = String(unit || 'minutes').trim().toLowerCase() === 'seconds' ? 'seconds' : 'minutes';
|
const normalizedUnit = String(unit || 'minutes').trim().toLowerCase();
|
||||||
if (normalizedUnit === 'seconds') {
|
if (normalizedUnit === 'seconds') {
|
||||||
return value === 1 ? 'Every second' : `Every ${value} seconds`;
|
return value === 1 ? 'Every second' : `Every ${value} seconds`;
|
||||||
}
|
}
|
||||||
|
if (normalizedUnit === 'hours') {
|
||||||
|
return value === 1 ? 'Every hour' : `Every ${value} hours`;
|
||||||
|
}
|
||||||
return value === 1 ? 'Every minute' : `Every ${value} minutes`;
|
return value === 1 ? 'Every minute' : `Every ${value} minutes`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,14 @@ const DATE_FILTER_FIELDS = {
|
|||||||
|
|
||||||
function formatIntervalLabel(intervalMs) {
|
function formatIntervalLabel(intervalMs) {
|
||||||
const value = Math.max(1, Number(intervalMs) || 0);
|
const value = Math.max(1, Number(intervalMs) || 0);
|
||||||
|
if (value % 86400000 === 0) {
|
||||||
|
const days = Math.max(1, value / 86400000);
|
||||||
|
return days === 1 ? 'Every day' : `Every ${days} days`;
|
||||||
|
}
|
||||||
|
if (value % 3600000 === 0) {
|
||||||
|
const hours = Math.max(1, value / 3600000);
|
||||||
|
return hours === 1 ? 'Every hour' : `Every ${hours} hours`;
|
||||||
|
}
|
||||||
if (value % 60000 === 0) {
|
if (value % 60000 === 0) {
|
||||||
const minutes = Math.max(1, value / 60000);
|
const minutes = Math.max(1, value / 60000);
|
||||||
return minutes === 1 ? 'Every minute' : `Every ${minutes} minutes`;
|
return minutes === 1 ? 'Every minute' : `Every ${minutes} minutes`;
|
||||||
|
|||||||
@@ -90,6 +90,7 @@
|
|||||||
<select id="api-source-interval-unit" name="update_interval_unit" class="form-select">
|
<select id="api-source-interval-unit" name="update_interval_unit" class="form-select">
|
||||||
<option value="seconds" {{#if (eq apiSource.updateIntervalUnit 'seconds')}}selected{{/if}}>Seconds</option>
|
<option value="seconds" {{#if (eq apiSource.updateIntervalUnit 'seconds')}}selected{{/if}}>Seconds</option>
|
||||||
<option value="minutes" {{#if (eq apiSource.updateIntervalUnit 'minutes')}}selected{{/if}}>Minutes</option>
|
<option value="minutes" {{#if (eq apiSource.updateIntervalUnit 'minutes')}}selected{{/if}}>Minutes</option>
|
||||||
|
<option value="hours" {{#if (eq apiSource.updateIntervalUnit 'hours')}}selected{{/if}}>Hours</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
<select id="rss-feed-interval-unit" name="update_interval_unit" class="form-select">
|
<select id="rss-feed-interval-unit" name="update_interval_unit" class="form-select">
|
||||||
<option value="seconds" {{#if (eq rssFeed.updateIntervalUnit 'seconds')}}selected{{/if}}>Seconds</option>
|
<option value="seconds" {{#if (eq rssFeed.updateIntervalUnit 'seconds')}}selected{{/if}}>Seconds</option>
|
||||||
<option value="minutes" {{#if (eq rssFeed.updateIntervalUnit 'minutes')}}selected{{/if}}>Minutes</option>
|
<option value="minutes" {{#if (eq rssFeed.updateIntervalUnit 'minutes')}}selected{{/if}}>Minutes</option>
|
||||||
|
<option value="hours" {{#if (eq rssFeed.updateIntervalUnit 'hours')}}selected{{/if}}>Hours</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-4">
|
<div class="col-12 col-md-4">
|
||||||
|
|||||||
@@ -92,3 +92,43 @@ test('background task pages opt into 24-hour timestamps, confirm clearing tasks,
|
|||||||
assert.match(scheduledHtml, /data-local-datetime-format="24h"/);
|
assert.match(scheduledHtml, /data-local-datetime-format="24h"/);
|
||||||
assert.match(scheduledHtml, /Player:\s+Player Beta/);
|
assert.match(scheduledHtml, /Player:\s+Player Beta/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('scheduled task interval labels use the largest exact unit while sorting stays numeric', () => {
|
||||||
|
const scheduledHtml = renderBackgroundTasksScheduledPage(
|
||||||
|
{
|
||||||
|
recurringTasks: [
|
||||||
|
{
|
||||||
|
title: 'Hourly task',
|
||||||
|
key: 'hourly',
|
||||||
|
intervalMs: 7200000,
|
||||||
|
metadata: {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Second task',
|
||||||
|
key: 'seconds',
|
||||||
|
intervalMs: 3000,
|
||||||
|
metadata: {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Minute task',
|
||||||
|
key: 'minutes',
|
||||||
|
intervalMs: 60000,
|
||||||
|
metadata: {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
sort: 'interval',
|
||||||
|
direction: 'asc',
|
||||||
|
summary: { counts: {}, total: 3, activeCount: 0, scheduledCount: 3 }
|
||||||
|
},
|
||||||
|
'',
|
||||||
|
{
|
||||||
|
permissions: ['scheduled-tasks.allow']
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.match(scheduledHtml, /Every 3 seconds/);
|
||||||
|
assert.match(scheduledHtml, /Every minute/);
|
||||||
|
assert.match(scheduledHtml, /Every 2 hours/);
|
||||||
|
assert.ok(scheduledHtml.indexOf('Every 3 seconds') < scheduledHtml.indexOf('Every minute'));
|
||||||
|
assert.ok(scheduledHtml.indexOf('Every minute') < scheduledHtml.indexOf('Every 2 hours'));
|
||||||
|
});
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
const test = require('node:test');
|
||||||
|
const assert = require('node:assert/strict');
|
||||||
|
const fs = require('node:fs');
|
||||||
|
const path = require('node:path');
|
||||||
|
|
||||||
|
const { buildApiSourcePayload } = require('../src/data/api-sources');
|
||||||
|
const { buildRssFeedPayload } = require('../src/data/rss-feeds');
|
||||||
|
const { normalizeIntervalMs } = require('../src/web/lib/background-tasks/queue');
|
||||||
|
|
||||||
|
test('data source payloads accept hours as an update interval unit', () => {
|
||||||
|
const apiPayload = buildApiSourcePayload({
|
||||||
|
body: {
|
||||||
|
name: 'API source',
|
||||||
|
api_url: 'https://example.com/api',
|
||||||
|
update_interval_value: '2',
|
||||||
|
update_interval_unit: 'hours'
|
||||||
|
}
|
||||||
|
}, null);
|
||||||
|
|
||||||
|
const rssPayload = buildRssFeedPayload({
|
||||||
|
body: {
|
||||||
|
name: 'RSS feed',
|
||||||
|
feed_url: 'https://example.com/feed.xml',
|
||||||
|
update_interval_value: '3',
|
||||||
|
update_interval_unit: 'hours',
|
||||||
|
item_limit: '5'
|
||||||
|
}
|
||||||
|
}, null);
|
||||||
|
|
||||||
|
assert.equal(apiPayload.updateIntervalUnit, 'hours');
|
||||||
|
assert.equal(apiPayload.updateIntervalValue, 2);
|
||||||
|
assert.equal(rssPayload.updateIntervalUnit, 'hours');
|
||||||
|
assert.equal(rssPayload.updateIntervalValue, 3);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('background task interval conversion supports hours', () => {
|
||||||
|
assert.equal(normalizeIntervalMs(2, 'hours'), 7_200_000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('data source forms expose hours as an interval option', () => {
|
||||||
|
const apiTemplate = fs.readFileSync(path.join(__dirname, '..', 'src', 'web', 'views', 'data-sources', 'api-sources', 'form.hbs'), 'utf8');
|
||||||
|
const rssTemplate = fs.readFileSync(path.join(__dirname, '..', 'src', 'web', 'views', 'data-sources', 'rss-feeds', 'form.hbs'), 'utf8');
|
||||||
|
|
||||||
|
assert.match(apiTemplate, /value="hours"[\s\S]*>Hours<\/option>/);
|
||||||
|
assert.match(rssTemplate, /value="hours"[\s\S]*>Hours<\/option>/);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user