Files
pulse-signage/src/web/routes/data-sources/weather/list.js
T
lzstealth c3299abaac
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile, web, pulse-signage-web) (push) Successful in 1m53s
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile.player, player, pulse-signage-player) (push) Successful in 32s
Release v2.14.1
2026-10-11 18:54:43 +01:00

16 lines
781 B
JavaScript

const { renderView } = require('#src/web/view');
function formatInterval(value, unit) {
const amount = Math.max(1, Number(value) || 0);
const normalized = String(unit || 'minutes');
return 'Every ' + amount + ' ' + normalized.replace(/s$/, '') + (amount === 1 ? '' : 's');
}
module.exports = function renderWeatherLocationsPage(data, message, currentUser) {
return renderView('data-sources/weather/list', {
title: 'Weather locations', active: 'weather', message, currentUser: currentUser || null,
weatherLocations: (data.weatherLocations || []).map(function (location) {
return Object.assign({}, location, { intervalLabel: formatInterval(location.update_interval_value, location.update_interval_unit) });
}), pagination: data.pagination || null
});
};